Reputation: 4058
I'm trying to figure out what's the best way to deploy my sites using git, I set up a bare repo on my server so I can push my local repos to it and it works fine but I have a few questions:
Let's say my repo is inside my public_html
folder in my server, if I create it using git init --bare
I'd just be able to push my local .git
folder so I won't have access to my working directory files, and if I create a regular repo with git init
I get a warning everytime I try to push saying that I shouldn't be pushing to non-bare repos. So what should I do? Github for example does store my working files but I don't get the weird warning message.
Thanks in advance!
Upvotes: 1
Views: 377
Reputation: 22262
Two choices really:
1) Have the actual website pull from your bare repo on a regular basis (eg, via cron)
2) Have the actual website pull form your master repo (assuming it's accessible via a pull and the changes end up in master (or similar) and you don't ever commit things to master that aren't ready to go)
3) Use a hook in the bare repo to execute a git pull
in the real location after the push is completed. If you go this route, be sure to unset the GIT_DIR environment variable that will end up being set in the hook's environment.
Upvotes: 2