git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: git fetch with multiple remotes failing?
Date: Tue, 31 Oct 2006 08:32:06 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0610310819170.25218@g5.osdl.org> (raw)
In-Reply-To: <20061031155913.GA5157@mellanox.co.il>



On Tue, 31 Oct 2006, Michael S. Tsirkin wrote:
> 
> $ cat .git/remotes/origin
> URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> Pull: +refs/heads/master:refs/heads/linus_master
> $ cat .git/remotes/jejb-scsi-misc-2.6
> URL: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
> Pull: +refs/heads/master:refs/heads/jejb-scsi-misc-2.6
> $ git fetch -f origin jejb-scsi-misc-2.6
> error: no such remote ref refs/heads/jejb-scsi-misc-2.6
> Fetch failure:
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> 
> Looks I must give remotes one by one?

Yes. A single "fetch" will only ever connect to a single repository. If 
you want to fetch from multiple repositories, you have to do multiple 
connections, and thus multiple "fetch"es.

The protocol doesn't even really allow for connecting to two different 
repositories with one connection.

There's also a purely syntactic issue: when you say

	git fetch -f origin jejb-scsi-misc-2.6

then the "origin" is considered to specify the repository (and any 
"default branches") and any subsequent arguments are considered to 
override the _branch_ information in that repository. So the above command 
literally means "fetch branch 'jejb-scsi-misc-2.6' from the repository 
described by 'origin'".

Btw, this _syntactic_ issue is separate from the issue of actually 
initiating multiple connections. For example, "git push" actually 
understands that you can push multiple different repositories at once, but 
even then you can't specify it on the command line directly, for the exact 
same reason as the above "git fetch" thing: the first argument is 
considered the "repository" specifier, and any subsequent arguments are 
specifiers for which branches/tags to push.

So for "git push" (where it makes sense to push the same branches multiple 
times), you can actually do what I do:

 - .git/config contains:

	[remote "all"]
		url = master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
		url = login.osdl.org:linux-2.6.git

 - and not "git push all master" will push the "master" branch to _both_ 
   of those remote repositories.

However, even that doesn't really make sense for "git fetch": while it is 
a sensible operation to push the same branch-specifier to more than one 
repository, it does _not_ make sense to _fetch_ the same branch-specifier 
from more than one repository.

So multiple fetches would only make sense if you don't allow any branch 
specifiers (and then they'd be fetched from whatever branches the 
"remotes" file says). But that would make "git fetch" have two totally 
different modes, so that's not very good either.

And in the end, even a "git push all" that pushes to multiple repositories 
will actually end up connecting once for each repository, so it's really 
just a shorthand for doing multiple "git push"es. There's no real 
technical advantage, just a convenience.

So I'd suggest just doing

	git fetch origin
	git fetch jejb-scsi-misc-2.6

separately. Sadly, there's not even any way to fake this out with a git 
alias.


  reply	other threads:[~2006-10-31 16:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-31 15:59 git fetch with multiple remotes failing? Michael S. Tsirkin
2006-10-31 16:32 ` Linus Torvalds [this message]
2006-11-01  0:12   ` Petr Baudis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0610310819170.25218@g5.osdl.org \
    --to=torvalds@osdl.org \
    --cc=git@vger.kernel.org \
    --cc=mst@mellanox.co.il \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).