Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Talk:EGit/Git For Eclipse Users"

m (Bare repository: new section)
m (Added a note on ''cd'' commands that this switches repositories.)
 
Line 7: Line 7:
 
To avoid getting an error like this:
 
To avoid getting an error like this:
  
remote: error: refusing to update checked out branch: refs/heads/master
+
  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: 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: 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: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
+
  remote: error: the work tree to HEAD.
remote: error:
+
  remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
+
  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: '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: 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: arranged to update its work tree to match what you pushed in some
remote: error: other way.
+
  remote: error: other way.
remote: error:
+
  remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
+
  remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
+
  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.
 
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.

Latest revision as of 17:23, 31 July 2015

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.

Back to the top