Question

I followed the instructions in this guide to the letter in order to deploy a project to a remote repo using Git. There are no errors when I do this but nothing on the remote site changes. I see this when pushing via this:

git push dreamhost master

Counting objects: 252, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (250/250), done.
Writing objects: 100% (252/252), 994.11 KiB, done.
Total 252 (delta 100), reused 0 (delta 0)
To ssh://[username]@bartow.dreamhost.com/home/[username]/[filename].git
 * [new branch]      master -> master

I have a post-receive hook setup as well that should run:

#!/bin/sh
git --work-tree=/home/timjaeger/[sitename] --git-dir=/home/timjaeger/[sitename].git
checkout -f

Since I am not getting any error messages it is difficult to know how to troubleshoot this - where do I begin? I am a beginner at using Git for deployment.

Was it helpful?

Solution

Changing the post-receive to this:

#!/bin/sh
GIT_WORK_TREE=/home/timjaeger/[sitename].com git checkout -f

worked. This article helped in finding the solution.

OTHER TIPS

If you have a working tree at /home/timjaeger/[sitename], then your git repo cannot be /home/timjaeger/[sitename].git.

It should be /home/timjaeger/[sitename]/.git, but that would make /home/timjaeger/[sitename] a non-bare repo to which it would be unwise to push directly.

The work tree shoudl be separate from the bare repo git directory /home/timjaeger/[sitename].git.

By not mentioning the git-dir option (which the OP squeezemylime recommends), you keep the hook current execution directory in place (i.e. that hook will look the git repository there), while specifying a different working tree.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top