title: Couldn't set refs/heads/master when commit
body: <p>I was able to commit fine yesterday. But today (I didn't change anything), when I commit:</p>
  
  <pre><code>$ git add config.h
  $ git commit -m "Update config.h to reset the values"
  error: Couldn't set refs/heads/master
  fatal: cannot update HEAD ref
  </code></pre>
  
  <p>I know that this error may happen also during pull or push. But I haven't found a solution to fix it when committing.</p>
  
  <p>My .git/config file looks like this:</p>
  
  <pre><code>[core]
      repositoryformatversion = 0
      filemode = false
      bare = false
      logallrefupdates = true
      symlinks = false
      ignorecase = true
      hideDotFiles = dotGitOnly
  [remote "origin"]
      url = git@SOME_URL
      fetch = +refs/heads/*:refs/remotes/origin/*
  [branch "master"]
      remote = origin
      merge = refs/heads/master
  </code></pre>