This may be a question about convention, best practices and/or personal preferences:
So I'm a git noob, and my website code is not worth sharing, so I'm not using github or the like.
Knowing that git doesn't need a central repository I thought: great, my workstation and the server are the two nodes, and I'll just push changes from my workstation to the server.
When I started, the code was only on the server, so I:
git init
git clone me@myserver:path/to/repo
git push me@myserver:path/to/repo
I got strange results. The files I had added locally appeared on the server, but changes to existing files weren't reflected.
I then read a warning against pushing to a remote branch that is checked out. So the new setup is:
git clone --bare
to make a bare repository~/repos/mysite.git
- not a public folder)git push me@myserver:repos/mysite.git
git pull ~/repos/mysite.git
to get the latestIs this correct? Is it logical? Is it what you would do?
Your new setup is the correct way to set up a server repository.
Refer to the Getting Git on a Server chapter on the Pro Git book for more information.