I had some trouble with my git repositories at freedesktop.org in the past, as you may remember [1,2]. Last week I run in some trouble again. As it looks, they updated the git server to a new version, since the update I got the following error message on push:
error: refusing to update checked out branch: refs/heads/master
error: By default, updating the current branch in a non-bare repository
error: is denied, because it will make the index and work tree inconsistent
error: with what you pushed, and will require 'git reset --hard' to match
error: the work tree to HEAD.
error: You can set 'receive.denyCurrentBranch' configuration variable to
error: 'ignore' or 'warn' in the remote repository to allow pushing into
error: its current branch; however, this is not recommended unless you
error: arranged to update its work tree to match what you pushed in some
error: other way.
error: To squelch this message and still keep the default behaviour, set
error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'ssh://email@example.com/~dkukawka/hal.git'
Unfortunately the instructions from the error didn't help me to make push work again. I tried 'git reset --hard'and also to clone the repo again from the server, apply the new patches etc. but it didn't work. Here is what I had to do to get it work again:
I don't know how it happened in the first place to be non-bare, but this should set the remote repository again to a bare repo and you are able to push again.