Frage

When trying to push a commit to a bare remote repository I'm receiving the following error:

Push: Not all refs have been pushed. 'master' rejected (non-fast-forward) 
refusing to update checked out branch: refs/heads/master. By default, updating 
the current branch in a non-bare repository is denied, because it will make 
the index and work tree inconsistent with what you pushed, and will require 
'git reset --hard' to match the work tree to HEAD.

You can set 'receive.denyCurrentBranch' configuration variable to 'ignore' or 
'warn' in the remote repository to allow pushing into its current branch; 
however, this is not recommended unless you arranged to update its work tree 
to match what you pushed in some other way.        

To squelch this message and still keep the default behaviour, set
'receive.denyCurrentBranch' configuration variable to 'refuse'.

error: failed to push some refs to 'server'

I've researched the error and it appears to suggest that the repository I'm pushing to is not bare, which is not the case. Could this be an issue with git? I'm using SmartGit client.

I've also tried pulling from the remote repo, which doesn't have any effect.

War es hilfreich?

Lösung

Ok thats weird, I definitely checked the git config file previously and it had bare set to true. I'm totally sure of it!

Also people including myself have been able to push commits to this repo previously. The command you issued returned false, so I rechecked the git config file and bare was set to false. I set it to true and pushed, problem solved!

git config --bool core.bare
#returned false

The config file must have been edited at some point without my knowledge.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top