Search code examples
gitgit-post-receive

git post-receive hook and prevent tags pushing


In my GIT's post-receive hook I need to avoid execution of some code if a tag is pushed.

I tried using the env variable $refname but it looks empty.

Any idea?

Thanks

Randomize


Solution

  • Post receive hook gets something like

    refs/tag/FOO in case of tags and 
    refs/heads/branch-foo in case of branches
    

    based of tags Vs branches you can determine.