Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just installed Gitolite on a server, so any repositories that I'm pushing into on it should be bare repositories, and I've even went into the repo directories, and ran git init --bare in them to make sure that they are bare, but when I try to push into them, I still get this error message:

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'.

I even ran git config receive.denyCurrentBranch ignore to try to get it to just push into the remote repo, but the error still comes up.

I'm not sure what I'm doing wrong here.

share|improve this question
Check this link: - It explains the differences between bare and non-bare repos. – Sep 23 '15 at 15:25

You shouldn't have to run a git init --bare yourself.

Simply declare a new repo name in the gitolite.conf file of the gitolite-admin repo, push that back to the gitolite server, and gitolite itself will create that repo properly (in ~/repositories/mynewrepo.git, as a bare repo)

share|improve this answer
Yeah, that's what I started out doing, and it was giving me this error. – supercheetah Jul 18 '13 at 12:35
@supercheetah it gives you that error when you are declaring a new repo in the gitolite.conf file and pushing it to the gitolite server? Do you have a .gitolite.rc file in that gitolite home dir on that server? – VonC Jul 18 '13 at 15:24
That's correct, and yes, there is a .gitolite.rc file. – supercheetah Jul 19 '13 at 0:34
up vote 0 down vote accepted

I figured out that if there is a user on the Gitolite server that Git will log into that user instead of through Gitolite, and I didn't realize that. And I also had a copy of the repo I was trying to push in my user directory, and so of course it wasn't bare.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.