Situation:
What do I want to do?
If I set up a git repo locally using git init, and then push to a folder on the server, it doesn't work. When I FTP to the server to check the files, they're actually there. When I SSH into the server and do git status, it's not clean, even though it should be since I just pushed to the server.
Steps I'm doing:
You need to write a post-receive hook that runs git checkout -f
after the remote git repository receives a push. See Using Git to manage a web site for details.
When you push to a git repository, it doesn't update that repository's working files. Generally when you push, you should be pushing to a bare repository--- that seems to be how they intended git push to work.
For one of my (local ) projects, I wrote a script to automatically check out the latest "ui" subdirectory when I push my work to a deployment repo. It's embedded in a previous answer here: Developing Django projects using Git
You could also simply have the post-update hook on the server do a "git reset --hard master" if someone pushes an update to master, and use a non-bare repo rather than having a separate area for checked-out files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With