git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Unhelpful "branch.master.remote = <nickname>" advice?

From
Tomas Carnecky <tom@dbservice.com>
Date
Nov 11, 2009, 19:10 UTC
Message-ID
<D6B0AE61-6CA3-4F79-BB50-B8795415BAB7@dbservice.com>
In-Reply-To
<1257965806.26362.132.camel@heerbeest>
On Nov 11, 2009, at 7:56 PM, Jan Nieuwenhuizen wrote:
Show 21 quoted lines
>> These are meant to be used with git-config(1):
>> git config branch.master.remote <nickname>
>
> Okay...that's the other thing I tried.  Look
>
>   $ cp .git/config .git/config.orig
>   19:32:05 janneke@peder:~/vc/gub
>   $ git config branch.master.remote = eddy
>   19:32:08 janneke@peder:~/vc/gub
>   $ diff -u .git/config.orig .git/config
>   --- .git/config.orig	2009-11-11 19:32:05.724046086 +0100
>   +++ .git/config	2009-11-11 19:32:08.304045852 +0100
>   @@ -6,6 +6,7 @@
>    [branch "master"]
> 	    remote = origin
> 	    merge = refs/heads/master
>   +	remote = =
>    [remote "origin"]
> 	    url = git@github.com:janneke/gub.git
> 	    fetch = +refs/heads/*:refs/remotes/origin/*
>   [1]19:32:10 janneke@peder:~/vc/gub

You used this: $ git config branch.master.remote = <something> Do you see the difference between that and what I posted?

Show 7 quoted lines
> Also, if this is meant to be used with git config, then
> /why/ does the text say "in your configuration file"?
>
> I think it might be more helpful if this text said
> configuration file and gave a usable configuration file
> snippet, or alternatively said git config, and gave usable
> git config commands.
Feel free to send a patch ;)
Show 44 quoted lines
>
>> Or if you want to manually edit the config file, add this:
>>
>> [branch "master"]
>>    remote = <nickname>
>>
>> etc.
>
> Thanks!  Tried this.  However, there already was a
>
>  [branch "master"]
>       remote = origin
>
> which is my default branch that I publish to and pull
> from.  After adding a nickname for this new branch that
> I'll probably be pulling from a lot, my config file reads
>
>   [branch "master"]
> 	    remote = origin
> 	    merge = refs/heads/master
>   [remote "origin"]
> 	    url = git@github.com:janneke/gub.git
> 	    fetch = +refs/heads/*:refs/remotes/origin/*
>   # advise from git pull, using <nickname> = eddy
>   #        branch.master.remote = <nickname>
>   #        branch.master.merge = <remote-ref>
>   #        remote.<nickname>.url = <url>
>   #        remote.<nickname>.fetch = <refspec>
>   [branch "master"]
> 	    remote = eddy
> 	    merge = refs/heads/master
>   [remote "eddy"]
> 	    url = http://github.com/epronk/gub.git
> 	    fetch = +refs/heads/*:refs/remotes/origin/*
>
> With this new "eddy" addition
>
> git pull -r eddy
>
> seems to work fine, but the good old default pull now says
>
>   $ git pull -r
>   error: More than one value for the key branch.master.remote: eddy
>   Current branch master is up to date.

branch.master.remote has two different values, git doesn't know which remote to use. Do you want to pull from origin or eddy? I would recommend only keeping one [branch "master"] section and edit it appropriately.

Show 26 quoted lines
> and I'm not really sure where it pulls from?  Then I think,
> possibly now I need to specify the <nickname> for the default
> url too [never knew that was a nick], which has automagically
> be named "origin".  Yes, that makes sense.
>
> Well, /then/ I get thoroughly confused
>
>   $ git pull -r origin
>   You asked me to pull without telling me which branch you
>   want to merge with, and 'branch.master.merge' in
>   your configuration file does not tell me either.	Please
>   specify which branch you want to merge on the command line and
>   try again (e.g. 'git pull <repository> <refspec>').
>   See git-pull(1) for details.
>
>   If you often merge with the same branch, you may want to
>   configure the following variables in your configuration
>   file:
>
> 	branch.master.remote = <nickname>
> 	branch.master.merge = <remote-ref>
> 	remote.<nickname>.url = <url>
> 	remote.<nickname>.fetch = <refspec>
>
>   See git-config(1) for details.
>   [1]19:43:02 janneke@peder:~/vc/gub

Hm, I can't explain that one. I would use either the short form (git pull -r) or the long form (git pull -r origin master). Try removing the duplicate branch.master section and try again.

Show 8 quoted lines
>
>> As 'pull == fetch + merge' (pull -r == fetch + rebase), pull without
>> merge would be fetch.
>
> Okay, that's fighting over naming conventions, let me retry this.
> I still wonder why does Git have a shorthand for fetch + merge [pull],
> which you almost never want, and no shorthand for fetch + rebase
> [known to most *CS/*SCM users as "update"]?

Is 'git pull -r' not short enough for you? If not, feel free to create a alias: $ git config alias.up 'pull -r'

tom
Previous: Junio C HamanoNext: Jan Nieuwenhuizen
Message 7 of 26 in “Unhelpful "branch.master.remote = <nickname>" advice?”
  1. Jan NieuwenhuizenNov 11, 2009
  2. Tomas CarneckyNov 11, 2009
  3. Makefile: add uninstall target. Fixes elementary good cleaning manners.Jan Nieuwenhuizen, Nov 18, 2009
  4. Matthieu MoyNov 18, 2009
  5. Jan KrügerNov 11, 2009
  6. Junio C HamanoNov 11, 2009
  7. Tomas CarneckyNov 11, 2009
  8. Jan NieuwenhuizenNov 11, 2009
  9. Tomas CarneckyNov 11, 2009
  10. Jan NieuwenhuizenNov 12, 2009
  11. git-pull.sh: overhaul error handling when no candidates are foundJan Krüger, Nov 12, 2009
  12. Jeff KingNov 12, 2009
  13. Jan KrügerNov 12, 2009
  14. Jeff KingNov 12, 2009
  15. git-pull.sh --rebase: overhaul error handling when no candidates are foundJan Krüger, Nov 12, 2009
  16. Jonathan NiederNov 13, 2009
  17. pull: clarify advice for the unconfigured error caseJonathan Nieder, Nov 27, 2009
  18. Junio C HamanoDec 2, 2009
  19. Jonathan NiederDec 3, 2009
  20. Jeff KingDec 3, 2009
  21. Jan NieuwenhuizenDec 3, 2009
  22. Jan KrügerDec 3, 2009
  23. Junio C HamanoDec 7, 2009
  24. Junio C HamanoNov 15, 2009
  25. Björn SteinbrinkNov 12, 2009
  26. Tomas CarneckyNov 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.