# getting pull and push URLs for the current branch

2 messages from 2018-04-08 to 2018-04-08. Participants: Michal Novotny, Ævar Arnfjörð Bjarmason.
Thread: https://gitlist.dev/t/48241

## Michal Novotny, 2018-04-08 10:15

Subject: getting pull and push URLs for the current branch
Message-ID: <CANT8FXS_vsXb5oyma+d7fgEaYBqFYjM2N=S6O6hksObHhN8gWw@mail.gmail.com>
URL: https://gitlist.dev/e/CANT8FXS_vsXb5oyma%2Bd7fgEaYBqFYjM2N%3DS6O6hksObHhN8gWw%40mail.gmail.com

```
Hello,

is there a way to get remote url  for the current branch? That is the
url that will be used when I call `git pull`. It doesn't seem to be a
particularly easy task.

Thank you!
clime

```

## Ævar Arnfjörð Bjarmason, 2018-04-08 11:46

Subject: Re: getting pull and push URLs for the current branch
Message-ID: <87o9itzzs3.fsf@evledraar.gmail.com>
URL: https://gitlist.dev/e/87o9itzzs3.fsf%40evledraar.gmail.com
In-Reply-To: <CANT8FXS_vsXb5oyma+d7fgEaYBqFYjM2N=S6O6hksObHhN8gWw@mail.gmail.com>

```

On Sun, Apr 08 2018, Michal Novotny wrote:

> is there a way to get remote url  for the current branch? That is the
> url that will be used when I call `git pull`. It doesn't seem to be a
> particularly easy task.

You'd do something like this (sans error checking):

    git remote get-url $(git config branch.$(git rev-parse --abbrev-ref HEAD).remote)

I.e. your HEAD may have remote tracking info set up, this'll get the
remote URL for the remote it points at.

```
