title: How can I test my pre-receive hook?
body: <p>I need to create a pre-receive hook that rejects push from any client from any branch which is not master, So I wrote this script:</p>
  
  <pre><code>     #!/bin/bash
  
      refname="$0"
      oldrev="$1"
      newrev="$2"
  
      alowed_branch='master'
      current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
  
      if [ $alowed_branch = $current_branch ]
      then
        echo "you are pushing to master branch"
        exit 0
      else
        echo Branch $current_branch is Locked.
       exit 1
      fi
  </code></pre>
  
  <p>Now I don't know how can I test it...</p>
  
  <p>When tested on a 'pre-commit' hook on my local git repo I get what I want:</p>
  
  <p><a href="https://i.stack.imgur.com/dNibH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dNibH.png" alt="enter image description here"></a></p>
  
  <p>But when trying to test it as a pre-push or pre-receive hook as suggested it doesn't take any effect and I can commit and push with no interference.</p>
  
  <p>is there a way to test it on GitHub?</p>