2012-01-11 3 views
1

을 실행하지 : 실행 파일입니다자식 게시물-받는이 포스트받을 다음 내가 설정을 가지고

$ cat .git/hooks/post-receive 
#!/bin/env sh 
git checkout -f 

: 내 로컬 컴퓨터에서 그것으로 누르면

$ l .git/hooks/post-receive 
-rwx--x--x 1 nils nils 30 11. Jan 13:17 .git/hooks/post-receive 

그래서 체크 아웃해야하며, 내가 현지에서 만든 변화를 가져라.

지역 : 원격 시스템 이후

$ cat > testfile 
hello world 

$ git add testfile && git commit -m "added testfile" && git push production master 
[master 9f5232d] added testfile 
1 files changed, 1 insertions(+), 0 deletions(-) 
create mode 100644 testfile 
Counting objects: 4, done. 
Delta compression using up to 2 threads. 
Compressing objects: 100% (2/2), done. 
Writing objects: 100% (3/3), 290 bytes, done. 
Total 3 (delta 1), reused 0 (delta 0) 
To ssh://[…]/ 
    88ce501..9f5232d master -> master 

: 그러나 그것은 사실이 아니다

$ git status --short 
D testfile 

그래서 그것의 작업 트리에서 testfile 위가없는

$ git checkout -f 

$ git status 
# On branch master 
nothing to commit (working directory clean) 

어떤 아이디어가 잘못되었을 수 있습니까?

#!/bin/env sh 
GIT_WORK_TREE=/var/www/website.org git checkout -f 

chmod +x 스크립트에 잊고 밀어 사용자가 체크 아웃 명령을 실행할 수있는 권한이 있는지 확인하지 마십시오

답변

2

당신은 체크 아웃이 바로 이곳에서 수행되었는지 확인하기 위해 GIT_WORK_TREE를 설정해야합니다 .