Reputation: 6828
Basically I thought I could use git for deployment as those rails cloud providers as heroku offer. So I created an app on the server, changed to that directory and did a git init in there. Next I created a http server with git-wep pointing that directory. Now I check out, that`s fine too and edit and commit to my repo.
Now, what I want to do next, would be to push to the server and have it update it's working directory as a post commit hook. deployed.
But git won't let me push. Probably I could
You can set 'receive.denyCurrentBranch' configuration variable to 'ignore'
but where would I do that? Where and how could I place the hook?
Upvotes: 2
Views: 474
Reputation: 526533
It'd be better to have the repository on the server be a bare repository (one that does not actually have a working copy - only the contents of the .git
directory), and then use something like git archive | tar -x -C /path/to/htdocs
in post-receive-hook to export the files into the served directory.
By using a bare repository as your target, you avoid the issue of pushing to a checked-out branch entirely.
To create a bare repository, pass the --bare
flag when you init:
git --bare init
Upvotes: 4