git post-update script does not work

后端 未结 3 1754
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-06 08:52

After editing my old question a few times, I make a new one because it is a new question now.

In .git/hooks/post-update I have:

echo \"a         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-06 09:41

    The solution is to use post-receive as Alex pointed out. Also you need run unset GIT_DIR at the top of your script.

    On the server I have created a second branch and switched to it:

    $ git branch
      master
    * testing
    

    My .git/hooks/post-receive now looks like this:

    unset GIT_DIR
    cd ..
    git merge master
    

    On the client I run git push.

提交回复
热议问题