Git won't push into a bare repository on server

4

1

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.

supercheetah

Posted 2013-07-18T08:05:22.527

Reputation: 836

1

Check this link: http://bitflop.com/tutorials/git-bare-vs-non-bare-repositories.html - It explains the differences between bare and non-bare repos.

– Meetai.com – 2015-09-23T15:25:55.803

Updating the link URL posted in the comment http://www.bitflop.dk/tutorials/how-to-create-a-new-and-empty-branch-in-git.html

– None – 2016-08-08T20:47:32.337

Answers

0

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.

supercheetah

Posted 2013-07-18T08:05:22.527

Reputation: 836

1

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)

VonC

Posted 2013-07-18T08:05:22.527

Reputation: 13 292

Yeah, that's what I started out doing, and it was giving me this error. – supercheetah – 2013-07-18T12:35:19.503

@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 – 2013-07-18T15:24:13.937

That's correct, and yes, there is a .gitolite.rc file. – supercheetah – 2013-07-19T00:34:05.763