{"thread":{"id":"43566","subject":"git fetch with multiple remotes failing?","startedAt":"2006-10-31T15:59:13Z","lastAt":"2006-11-01T00:12:42Z","messageCount":3,"participants":["Michael S. Tsirkin","Petr Baudis","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"295570","messageId":"20061031155913.GA5157@mellanox.co.il","threadId":"43566","inReplyTo":null,"subject":"git fetch with multiple remotes failing?","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2006-10-31T15:59:13Z","receivedAt":"2006-10-31T15:59:13Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"\n$ cat .git/remotes/origin\nURL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\nPull: +refs/heads/master:refs/heads/linus_master\n$ cat .git/remotes/jejb-scsi-misc-2.6\nURL: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git\nPull: +refs/heads/master:refs/heads/jejb-scsi-misc-2.6\n$ git fetch -f origin jejb-scsi-misc-2.6\nerror: no such remote ref refs/heads/jejb-scsi-misc-2.6\nFetch failure:\ngit://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n\nLooks I must give remotes one by one?\n\n\n-- \n"},{"id":"297224","messageId":"Pine.LNX.4.64.0610310819170.25218@g5.osdl.org","threadId":"43566","inReplyTo":"20061031155913.GA5157@mellanox.co.il","subject":"Re: git fetch with multiple remotes failing?","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-10-31T16:32:06Z","receivedAt":"2006-10-31T16:32:06Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 31 Oct 2006, Michael S. Tsirkin wrote:\n> \n> $ cat .git/remotes/origin\n> URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n> Pull: +refs/heads/master:refs/heads/linus_master\n> $ cat .git/remotes/jejb-scsi-misc-2.6\n> URL: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git\n> Pull: +refs/heads/master:refs/heads/jejb-scsi-misc-2.6\n> $ git fetch -f origin jejb-scsi-misc-2.6\n> error: no such remote ref refs/heads/jejb-scsi-misc-2.6\n> Fetch failure:\n> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n> \n> Looks I must give remotes one by one?\n\nYes. A single \"fetch\" will only ever connect to a single repository. If \nyou want to fetch from multiple repositories, you have to do multiple \nconnections, and thus multiple \"fetch\"es.\n\nThe protocol doesn't even really allow for connecting to two different \nrepositories with one connection.\n\nThere's also a purely syntactic issue: when you say\n\n\tgit fetch -f origin jejb-scsi-misc-2.6\n\nthen the \"origin\" is considered to specify the repository (and any \n\"default branches\") and any subsequent arguments are considered to \noverride the _branch_ information in that repository. So the above command \nliterally means \"fetch branch 'jejb-scsi-misc-2.6' from the repository \ndescribed by 'origin'\".\n\nBtw, this _syntactic_ issue is separate from the issue of actually \ninitiating multiple connections. For example, \"git push\" actually \nunderstands that you can push multiple different repositories at once, but \neven then you can't specify it on the command line directly, for the exact \nsame reason as the above \"git fetch\" thing: the first argument is \nconsidered the \"repository\" specifier, and any subsequent arguments are \nspecifiers for which branches/tags to push.\n\nSo for \"git push\" (where it makes sense to push the same branches multiple \ntimes), you can actually do what I do:\n\n - .git/config contains:\n\n\t[remote \"all\"]\n\t\turl = master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6\n\t\turl = login.osdl.org:linux-2.6.git\n\n - and not \"git push all master\" will push the \"master\" branch to _both_ \n   of those remote repositories.\n\nHowever, even that doesn't really make sense for \"git fetch\": while it is \na sensible operation to push the same branch-specifier to more than one \nrepository, it does _not_ make sense to _fetch_ the same branch-specifier \nfrom more than one repository.\n\nSo multiple fetches would only make sense if you don't allow any branch \nspecifiers (and then they'd be fetched from whatever branches the \n\"remotes\" file says). But that would make \"git fetch\" have two totally \ndifferent modes, so that's not very good either.\n\nAnd in the end, even a \"git push all\" that pushes to multiple repositories \nwill actually end up connecting once for each repository, so it's really \njust a shorthand for doing multiple \"git push\"es. There's no real \ntechnical advantage, just a convenience.\n\nSo I'd suggest just doing\n\n\tgit fetch origin\n\tgit fetch jejb-scsi-misc-2.6\n\nseparately. Sadly, there's not even any way to fake this out with a git \nalias.\n\n"},{"id":"295596","messageId":"20061101001242.GF20017@pasky.or.cz","threadId":"43566","inReplyTo":"Pine.LNX.4.64.0610310819170.25218@g5.osdl.org","subject":"Re: git fetch with multiple remotes failing?","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-11-01T00:12:42Z","receivedAt":"2006-11-01T00:12:42Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, Oct 31, 2006 at 05:32:06PM CET, I got a letter\nwhere Linus Torvalds <torvalds@osdl.org> said that...\n> On Tue, 31 Oct 2006, Michael S. Tsirkin wrote:\n> > $ cat .git/remotes/origin\n> > URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n> > Pull: +refs/heads/master:refs/heads/linus_master\n> > $ cat .git/remotes/jejb-scsi-misc-2.6\n> > URL: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git\n> > Pull: +refs/heads/master:refs/heads/jejb-scsi-misc-2.6\n> > $ git fetch -f origin jejb-scsi-misc-2.6\n> > error: no such remote ref refs/heads/jejb-scsi-misc-2.6\n> > Fetch failure:\n> > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n> > \n> > Looks I must give remotes one by one?\n> \n> Yes. A single \"fetch\" will only ever connect to a single repository. If \n> you want to fetch from multiple repositories, you have to do multiple \n> connections, and thus multiple \"fetch\"es.\n\nNote that I made a (hackish) patch for fetching from multiple\nrepositories in one connection (look for \"Allow fetching from multiple\nrepositories at once\"). It's currently in limbo since IIRC Junio wanted\nsome benchmarks, I don't have time to do them and the group I did this\nfor (the xorg people) has shown zero interest in testing the patch\neither.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\n"}]}