Monday, November 24, 2014

Using git to update a website

Basically, git is meant for version control.  You have a local repository that has live, working files.  But your remote repository is meant to be bare--without any live files.  This asymmetry is built into the system to avoid having people working on files that then get changed while they are working on them.

But what that means is that if you want to use git to update live files on a server, you have to go through a little extra work.  I say a little, because all you have to do is set up a bare repository that will receive your push.  And then you make a hook so that when that repository is pushed to, it will automatically update the files in your live folder, which will reside elsewhere.  As usual, Digital Ocean has a nice tutorial on the topic:

https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps

No comments:

Post a Comment