Search code examples
gitgithooksgit-remotegit-bare

Set up Git to manage remote website


I've been trying to set up Git to manage my website, as explained per this tutorial and this one and this one and this one and this gist.

To summarize what I've done: (in-depth explanations can be found in the tutorials)

  1. Set up a bare git repo on my web server in /home/usr/mysite.git/
  2. In the bare repo, create an executable post-receive hook with GIT_WORK_TREE set to my web documents root, /home/www/mysite.com/
  3. In my local git repo, add the remote repository. This is from my .git/config :

    [remote "live"]
    url = ssh://[email protected]/home/usr/mysite.git
    fetch = +refs/heads/*:refs/remotes/live/*
    
  4. Push : git push live +master:refs/heads/master

Here's the output I get:

Everything up-to-date

Great!
Except it isn't : my remote web documents root /home/www/mysite.com/ is still empty.
I've tried everything I could but haven't been able to push the files into my remote folder.

Do you know what I've done wrong, or what I could do to debug this?


Solution

  • The repo might in fact be up-to-date. Verify that by running git show on your server. Instead, maybe your post-receive hook isn't actually executed. If so, maybe because it isn't set as executable?