# Different Fetch and Push URLs?

4 messages from 2010-02-26 to 2010-02-26. Participants: Tim Visher, Jeff King, Tomas Carnecky.
Thread: https://gitlist.dev/t/22833

## Tim Visher, 2010-02-26 15:01

Subject: Different Fetch and Push URLs?
Message-ID: <c115fd3c1002260701u11cf506fq747d7217d31eba59@mail.gmail.com>
URL: https://gitlist.dev/e/c115fd3c1002260701u11cf506fq747d7217d31eba59%40mail.gmail.com

```
Hello Everyone,

My work situation leaves me in a situation where I can clone from my
central repo but I can't push there.  Is it possible and does it make
any sense to have a single remote with one URL that I pull from and
another than I push to?  I only ask because I was looking at the
output of `git remote show` and noticed that there are 2 URLs.  If it
is possible, how do I do it?  I looked in `.git/config` and there's
only 1 URL there.

I am aware that I could have 2 remotes and simply consciously remember
to only push to the one that I have access to.  This is what I usually
do but the scenario I describe above seems nicer to me.

Thanks!

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

```

## Tomas Carnecky, 2010-02-26 15:18

Subject: Re: Different Fetch and Push URLs?
Message-ID: <4B87E660.7010401@dbservice.com>
URL: https://gitlist.dev/e/4B87E660.7010401%40dbservice.com
In-Reply-To: <c115fd3c1002260701u11cf506fq747d7217d31eba59@mail.gmail.com>

```
On 2/26/10 4:01 PM, Tim Visher wrote:
> Hello Everyone,
>
> My work situation leaves me in a situation where I can clone from my
> central repo but I can't push there.  Is it possible and does it make
> any sense to have a single remote with one URL that I pull from and
> another than I push to?  I only ask because I was looking at the
> output of `git remote show` and noticed that there are 2 URLs.  If it
> is possible, how do I do it?  I looked in `.git/config` and there's
> only 1 URL there.
>
> I am aware that I could have 2 remotes and simply consciously remember
> to only push to the one that I have access to.  This is what I usually
> do but the scenario I describe above seems nicer to me.

git config remote.origin.pushurl <your push url>

(see the git-config(1) man page for more details)

tom

```

## Jeff King, 2010-02-26 15:20

Subject: Re: Different Fetch and Push URLs?
Message-ID: <20100226152043.GA26963@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20100226152043.GA26963%40coredump.intra.peff.net
In-Reply-To: <c115fd3c1002260701u11cf506fq747d7217d31eba59@mail.gmail.com>

```
On Fri, Feb 26, 2010 at 10:01:40AM -0500, Tim Visher wrote:

> My work situation leaves me in a situation where I can clone from my
> central repo but I can't push there.  Is it possible and does it make
> any sense to have a single remote with one URL that I pull from and
> another than I push to?  I only ask because I was looking at the
> output of `git remote show` and noticed that there are 2 URLs.  If it
> is possible, how do I do it?  I looked in `.git/config` and there's
> only 1 URL there.

Try "remote.*.pushurl". It's in git-config(1) and in git-push(1) under
"Named remote in configuration file".

-Peff

```

## Tim Visher, 2010-02-26 15:32

Subject: Re: Different Fetch and Push URLs?
Message-ID: <c115fd3c1002260732x79f44d8ft6bff9d9b4f226402@mail.gmail.com>
URL: https://gitlist.dev/e/c115fd3c1002260732x79f44d8ft6bff9d9b4f226402%40mail.gmail.com
In-Reply-To: <20100226152043.GA26963@coredump.intra.peff.net>

```
On Fri, Feb 26, 2010 at 10:20 AM, Jeff King <peff@peff.net> wrote:
> On Fri, Feb 26, 2010 at 10:01:40AM -0500, Tim Visher wrote:
>
>> My work situation leaves me in a situation where I can clone from my
>> central repo but I can't push there.  Is it possible and does it make
>> any sense to have a single remote with one URL that I pull from and
>> another than I push to?  I only ask because I was looking at the
>> output of `git remote show` and noticed that there are 2 URLs.  If it
>> is possible, how do I do it?  I looked in `.git/config` and there's
>> only 1 URL there.
>
> Try "remote.*.pushurl". It's in git-config(1) and in git-push(1) under
> "Named remote in configuration file".

Thanks, both of you.  That worked like a charm.

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

```
