I have an error using Git 1.9.
When I try to "git push" I receive the following error:
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'.
So, my first step was to read a lot here in this forum and tried to find some results from google. Sadly all I found was not working in my case.
I am working on Linux x86 and installed Git 1.9.
I can "git clone" one repository from my server and work in it.
For example I "touch testfile" in it to create a new file. Now I will "git commit" this file.
After this step I "git push" it and then I get the error code.
I found in other article's that the problem is solved in git 2.3
And that it should be helpful to change the value from "receive.denyCurrentBranch" in the config file from the repository.
Helpful values should be: refuse, updateInstead and ignore
I tried all of them and the error will be always the same.
On Server the config value ist:
[receive]
denyCurrentBranch = refuse
and the "git branch"
*master
On client the "git status" is:
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
So, the error will appear any time, I do not really know how to fix it yet.
How can I avoid that error message?