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

7 messages from 2008-06-30 to 2008-07-01. Participants: Adr3nal D0S, Jon Loeliger, Michael J Gruber, Junio C Hamano, Jakub Narebski.
Thread: https://gitlist.dev/t/14229

## Adr3nal D0S, 2008-06-30 18:58

Subject: Multiple remote.<...>.fetch and .push patterns
Message-ID: <308083c30806301158i1100c84dqe7f50daad417934c@mail.gmail.com>
URL: https://gitlist.dev/e/308083c30806301158i1100c84dqe7f50daad417934c%40mail.gmail.com

```
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, 2008-06-30 19:29

Subject: Re: Multiple remote.<...>.fetch and .push patterns
Message-ID: <48693434.4090402@freescale.com>
URL: https://gitlist.dev/e/48693434.4090402%40freescale.com
In-Reply-To: <308083c30806301158i1100c84dqe7f50daad417934c@mail.gmail.com>

```
Adr3nal D0S wrote:
> 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, 2008-06-30 19:52

Subject: Re: Multiple remote.<...>.fetch and .push patterns
Message-ID: <308083c30806301252l25f072anafbc457f48c6b19e@mail.gmail.com>
URL: https://gitlist.dev/e/308083c30806301252l25f072anafbc457f48c6b19e%40mail.gmail.com
In-Reply-To: <48693434.4090402@freescale.com>

```
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, 2008-07-01 09:00

Subject: Re: Multiple remote.<...>.fetch and .push patterns
Message-ID: <g4croa$3eu$1@ger.gmane.org>
URL: https://gitlist.dev/e/g4croa%243eu%241%40ger.gmane.org
In-Reply-To: <308083c30806301252l25f072anafbc457f48c6b19e@mail.gmail.com>

```
Adr3nal D0S venit, vidit, dixit 30.06.2008 21:52:
> 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, 2008-07-01 09:27

Subject: Re: Multiple remote.<...>.fetch and .push patterns
Message-ID: <7vprpynech.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vprpynech.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <g4croa$3eu$1@ger.gmane.org>

```
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

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, 2008-07-01 09:59

Subject: Re: Multiple remote.<...>.fetch and .push patterns
Message-ID: <g4cv6f$g29$1@ger.gmane.org>
URL: https://gitlist.dev/e/g4cv6f%24g29%241%40ger.gmane.org
In-Reply-To: <7vprpynech.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano venit, vidit, dixit 01.07.2008 11:27:
> 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).

> 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.

>                 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, 2008-07-01 13:04

Subject: Re: Multiple remote.<...>.fetch and .push patterns
Message-ID: <m3zlp1g3b3.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3zlp1g3b3.fsf%40localhost.localdomain
In-Reply-To: <308083c30806301158i1100c84dqe7f50daad417934c@mail.gmail.com>

```
"Adr3nal D0S" <adr3nald0s@gmail.com> writes:

> 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

```
