问题
I've followed this tutorial 'Using Git to manage a web site', using Tower to commit and push my local repo to the remote server. Pushing succeeds with the following message:
Pushing to ssh://user@mysite.com/~/git/tprevo.git
stdin: is not a tty
Counting objects: 40, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (37/37), done.
Writing objects: 100% (40/40), 171.95 KiB, done.
Total 40 (delta 3), reused 0 (delta 0)
To ssh://user@mysite.com/~/git/tprevo.git
* [new branch] master -> production
updating local tracking ref 'refs/remotes/production/production'
Successfully created tracking connection.
I've verified that my post-receive hook is executing, but the checkout
command doesn't add the pushed code into what I believe I've set up as my working directory. I've been trying to figure this out all day.
post-receive:
#!/bin/sh
GIT_WORK_TREE=/home/tprevo/public_html/tprevo git checkout -f
I'm new to Git and very keen to learn. What's the best way to debug this?
回答1:
Okay ... I've got a similar setup ... is your file executable? Please check the files attributes ...
ls -la post-receive
If it's not executable then you need to chmod it ...
sudo chmod +x post-receive
UPDATE
Noticing that you have a named branch you may want to be specific in the checkout command for your post-receive hook ...
git checkout -f production
来源:https://stackoverflow.com/questions/11121321/git-site-deployment-checkout-in-post-receive-hook-not-working