Force git to run post-receive hook, even if everything is “up-to-date”

后端 未结 9 1782
再見小時候
再見小時候 2020-11-30 19:27

How do I force git to run a post-receive hook on a server even if I don\'t have a new commit to push?

Background

I use git to aut

9条回答
  •  一个人的身影
    2020-11-30 19:41

    I like Jamie Carl's suggestion but it doesn't work, and I got the error:

    remote: error: By default, deleting the current branch is denied, because the next error: 'git clone' won't result in any file checked out, causing confusion.

    In my case I'm testing post-receive hooks on my localhost against a bare repository. Warning/super important, run this command only on the remote server location!

    git update-ref -d refs/heads/develop 
    

    It'll delete the reference for the develop branch (you may also need to delete any of the files you deployed for that branch too), then you can go ahead and do the git push deploy_localtest develop or whatever push command you want for that branch.

提交回复
热议问题