title: Git push to refs/heads/master fails on my mac, how to fix?
body: <p>I'm on mac os x, enabled ssh. I was trying to push local change to remote repo. I simulated remote repo locally like this: Create the remote repo</p>
  
  <pre><code>$cd ~/learn
  $mkdir gittest
  $cd gittest/
  $git init
  $git config --global user.name "username"
  $git config --global user.email "useremail"
  $touch readme
  $git add readme
  $git commit -m "empty"
  </code></pre>
  
  <p>OK, everything fine, then in another directory, I did:</p>
  
  <pre><code>$cd ~/learn/client
  $git clone trosky@localhost:/Users/trosky/learn/gittest
  $cd gittest
  $vi readme(add one line)
  $git add .
  $git commit -m "add line"
  $git push origin master:refs/heads/master
  </code></pre>
  
  <p>It failed and git says:</p>
  
  <pre><code>$git push origin master:refs/heads/master
  Total 0 (delta 0), reused 0 (delta 0)
  remote: error: refusing to update checked out branch: refs/heads/master
  remote: error: By default, updating the current branch in a non-bare repository
  remote: error: is denied, because it will make the index and work tree inconsistent
  remote: error: with what you pushed, and will require 'git reset --hard' to match
  remote: error: the work tree to HEAD.
  remote: error:
  remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
  remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
  remote: error: its current branch; however, this is not recommended unless you
  remote: error: arranged to update its work tree to match what you pushed in some
  remote: error: other way.
  remote: error:
  remote: error: To squelch this message and still keep the default behaviour, set
  remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
  To x@localhost:/Users/trosky/gittest
   ! [remote rejected] master -&gt; master (branch is currently checked out)
   error: failed to push some refs to 'x@localhost:/Users/trosky/learn/gittest'
  </code></pre>
  
  <p>Does this indicate that, either remote repo or local client side has any problem? How to fix it?</p>