Ok, check this out. I have a mac osx server with git installed. We use it for collaborating on projects. What we want is to be able to push to none-bare repository on the server so that we can view the websites on it. The problem is, a none-bare repository has a user with the master checked out, so were not able to push to the master.
The only way I have found working is to push to another branch and then merge it into the master branch, thats time-consuming and boring.
So, is there a way to push to the master branch on the remote server and be able to view the webpage on the server?
A common way to deal with this is to have a bare repository with a hook that will checkout
HEADto the correct directory, as described here. Essentially, you would create apost-receivehook that does:Then you just push to that bare repository in order to deploy. This method the advantage over pushing to a non-bare repository that you won’t end up with a
.gitdirectory under/var/www/whatever, just the files in your project.