Jump to: navigation, search

Talk:EGit/Git For Eclipse Users

The tutorial (which is great, by the way) works for me only when setting receive.denyCurrentBranch to ignore. Problem is: Without this setting I cannot push into the checked out branch.

Platform: msysgit 1.7.0.2-preview20100309, Windows7.

Bare repository

To avoid getting an error like this:

 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 have added a couple of lines to the tutorial. Just after we create the second "other" repository we need to tell git that it is a bare repository so we can push to it without having to set the "receive.denyCurrentBranch" config variable. Also added a line that will switch back from bare repository so we can perform the checkout.

It's not quite explicit enough, I think, that moving from one directory to another also makes the git system automatically change perspective so that the repository you moved to is now the default one. I modified this line to make it clearer:

 $ cd /tmp/other # Switch to 'other' repository. All git commands now apply to new repository.