threads / discuss / 14229

Multiple remote.<...>.fetch and .push patterns

Subject: Multiple remote.<...>.fetch and .push patterns

## tl;dr

7 messages between Jun 30, 2008 and Jul 1, 2008.

replies: 6people: 5as markdown or json

Adr3nal D0S· Jun 30, 2008, 18:58 UTC · lore
How can I do something like what is shown in Everyday git using git-config?
$ cat .git/remotes/ko
URL: kernel.org:/pub/scm/git/git.git
Pull: master:refs/tags/ko-master
Pull: next:refs/tags/ko-next
Pull: maint:refs/tags/ko-maint
Push: master
Push: next
Push: +pu
Push: maint
I know I can do:
git config remote.ko.fetch refs/heads/*:refs/tags/ko-*
but that will get all KO heads.  And I have no clue about the push version.
Jon Loeliger· Jun 30, 2008, 19:29 UTC · re: Adr3nal D0S · lore

Re: Multiple remote.<...>.fetch and .push patterns

Adr3nal D0S wrote:
Show 17 quoted lines
> How can I do something like what is shown in Everyday git using git-config?
> 
> $ cat .git/remotes/ko
> URL: kernel.org:/pub/scm/git/git.git
> Pull: master:refs/tags/ko-master
> Pull: next:refs/tags/ko-next
> Pull: maint:refs/tags/ko-maint
> Push: master
> Push: next
> Push: +pu
> Push: maint
> 
> I know I can do:
> 
> git config remote.ko.fetch refs/heads/*:refs/tags/ko-*
> 
> but that will get all KO heads.  And I have no clue about the push version.
The file is editable!
You can have both Push: and Pull: lines for a remote there.
Or have I misunderstood your question here?
jdl
Adr3nal D0S· Jun 30, 2008, 19:52 UTC · re: Jon Loeliger · lore

Re: Multiple remote.<...>.fetch and .push patterns

In reference to my question about .git/remotes/ko, Jon Loeliger <jdl@freescale.com> wrote:

> You can have both Push: and Pull: lines for a remote there.
>
> Or have I misunderstood your question here?
I know that I can create files in .git/remotes that look like Linus'
ko sample.  But I was wondering if this could be done with git-config.
 I have some developers that are new to SCMs in general and git in
particular. They are a little nervous playing in the git directory.

Also, I was uncertain how settings in .git/remotes files interact with git-config ...fetch and ...push settings, if at all.

Michael J Gruber· Jul 1, 2008, 09:00 UTC · re: Adr3nal D0S · lore

Re: Multiple remote.<...>.fetch and .push patterns

Adr3nal D0S venit, vidit, dixit 30.06.2008 21:52:
Show 14 quoted lines
> In reference to my question about .git/remotes/ko, Jon Loeliger
> <jdl@freescale.com> wrote:
> 
>> You can have both Push: and Pull: lines for a remote there.
>>
>> Or have I misunderstood your question here?
> 
> I know that I can create files in .git/remotes that look like Linus'
> ko sample.  But I was wondering if this could be done with git-config.
>  I have some developers that are new to SCMs in general and git in
> particular. They are a little nervous playing in the git directory.
> 
> Also, I was uncertain how settings in .git/remotes files interact with
> git-config ...fetch and ...push settings, if at all.

The files under remotes are the old way of configuring remotes (see git help push). The new are config lines in the remotes section, as written by "git remote". I don't think "git remote" can write the lines you want, so I'd suggest:

git config remote.ko.url kernel.org:/pub/scm/git/git.git git config remote.ko.fetch refs/heads/master:refs/tags/ko-master git config --add remote.ko.fetch refs/heads/next:refs/tags/ko-next git config --add remote.ko.fetch refs/heads/maint:refs/tags/ko-maint

You can add similar lines for push with the key remote.ko.push. Note that you have to use "--add" if you want to have multiple lines for the same key in config. Also, you can add a "+" in front of the refspec, but I'm a bit surprised you want that on pushing to ko.

Cheers, Michael

Junio C Hamano· Jul 1, 2008, 09:27 UTC · re: Michael J Gruber · lore

Re: Multiple remote.<...>.fetch and .push patterns

Michael J Gruber <michaeljgruber+gmane@fastmail.fm> writes:
Show 9 quoted lines
> The files under remotes are the old way of configuring remotes (see
> git help push). The new are config lines in the remotes section, as
> written by "git remote". I don't think "git remote" can write the
> lines you want, so I'd suggest:
>
> git config remote.ko.url kernel.org:/pub/scm/git/git.git
> git config remote.ko.fetch refs/heads/master:refs/tags/ko-master
> git config --add remote.ko.fetch refs/heads/next:refs/tags/ko-next
> git config --add remote.ko.fetch refs/heads/maint:refs/tags/ko-maint
I'd actually suggest:
	$ edit .git/config
and create this section:
        [remote "ko"]
                url = master.kernel.org:/pub/scm/git/git.git/
                fetch = +refs/heads/*:refs/remotes/ko/*
                push = heads/master
                push = heads/next
                push = +heads/pu
                push = heads/maint
(I used to say ko-master but these days I say ko/master).
Michael J Gruber· Jul 1, 2008, 09:59 UTC · re: Junio C Hamano · lore

Re: Multiple remote.<...>.fetch and .push patterns

Junio C Hamano venit, vidit, dixit 01.07.2008 11:27:
Show 15 quoted lines
> Michael J Gruber <michaeljgruber+gmane@fastmail.fm> writes:
> 
>> The files under remotes are the old way of configuring remotes (see
>> git help push). The new are config lines in the remotes section, as
>> written by "git remote". I don't think "git remote" can write the
>> lines you want, so I'd suggest:
>>
>> git config remote.ko.url kernel.org:/pub/scm/git/git.git
>> git config remote.ko.fetch refs/heads/master:refs/tags/ko-master
>> git config --add remote.ko.fetch refs/heads/next:refs/tags/ko-next
>> git config --add remote.ko.fetch refs/heads/maint:refs/tags/ko-maint
> 
> I'd actually suggest:
> 
> 	$ edit .git/config

Sure, it just seemed OP wanted cut-n-paste commands for his co-workers (or ko-workers).

Show 5 quoted lines
> and create this section:
> 
>         [remote "ko"]
>                 url = master.kernel.org:/pub/scm/git/git.git/
>                 fetch = +refs/heads/*:refs/remotes/ko/*
I think that's what OP wanted to avoid.
Show 6 quoted lines
>                 push = heads/master
>                 push = heads/next
>                 push = +heads/pu
>                 push = heads/maint
> 
> (I used to say ko-master but these days I say ko/master).
OK, that would make it ko/workers above ;)
Seriously: I found the info about those config keys in "git-push.1"; 
it's also in "git-{pull,fetch}.1". I would expect that info to be in 
"git-{remote,config}.1". The latter points to it, the former not really.
Michael
Jakub Narebski· Jul 1, 2008, 13:04 UTC · re: Adr3nal D0S · lore

Re: Multiple remote.<...>.fetch and .push patterns

"Adr3nal D0S" <adr3nald0s@gmail.com> writes:
Show 17 quoted lines
> How can I do something like what is shown in Everyday git using git-config?
> 
> $ cat .git/remotes/ko
> URL: kernel.org:/pub/scm/git/git.git
> Pull: master:refs/tags/ko-master
> Pull: next:refs/tags/ko-next
> Pull: maint:refs/tags/ko-maint
> Push: master
> Push: next
> Push: +pu
> Push: maint
> 
> I know I can do:
> 
> git config remote.ko.fetch refs/heads/*:refs/tags/ko-*
> 
> but that will get all KO heads.  And I have no clue about the push version.

remote.<name>.fetch in config is equivalent of "Pull:" line in $GIT_DIR/remotes/<name>, while remote.<name>.push in config is eqiovalent of "Push:" line in $GIT_DIR/remotes/<name>.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

← back to recent threads