# git push doesn't update the status with multiple remotes

3 messages from 2016-07-11 to 2016-07-12. Participants: Garoe, Johannes Sixt.
Thread: https://gitlist.dev/t/42820

## Garoe, 2016-07-11 16:54

Subject: git push doesn't update the status with multiple remotes
Message-ID: <5783CF57.1010105@gmail.com>
URL: https://gitlist.dev/e/5783CF57.1010105%40gmail.com

```
Hello,

I'm using git 1.9.1 in Ubuntu 14.04.

I have a repository on github, a clone on my desktop and bare repo on a 
private server, in my desktop the remotes looks like this

all	git@github.com:user/repo.git (fetch)
all	git@github.com:user/repo.git (push)
all	user@server.com:user/repo.git (push)
server	user@server.com:user/repo.git (fetch)
server	user@server.com:user/repo.git (push)
origin	git@github.com:user/repo.git (fetch)
origin	git@github.com:user/repo.git (push)

If I commit to master in my desktop and run 'git push all master', the 
github and the server repos are correctly updated, but if I run 'git 
status' the message says:

Your branch is ahead of 'origin/master' by 1 commit.
   (use "git push" to publish your local commits)

The message won't update unless I run git fetch or git push origin master.
I'd expect the git status to give me a updated status message after 
calling 'git push all master'.

Best regards,
Garoe



```

## Johannes Sixt, 2016-07-12 05:26

Subject: Re: git push doesn't update the status with multiple remotes
Message-ID: <84c1ac72-cbe7-7490-2c61-9302703cb28b@kdbg.org>
URL: https://gitlist.dev/e/84c1ac72-cbe7-7490-2c61-9302703cb28b%40kdbg.org
In-Reply-To: <5783CF57.1010105@gmail.com>

```
Am 11.07.2016 um 18:54 schrieb Garoe:
> I have a repository on github, a clone on my desktop and bare repo on a
> private server, in my desktop the remotes looks like this
>
> all    git@github.com:user/repo.git (fetch)
> all    git@github.com:user/repo.git (push)
> all    user@server.com:user/repo.git (push)
> server    user@server.com:user/repo.git (fetch)
> server    user@server.com:user/repo.git (push)
> origin    git@github.com:user/repo.git (fetch)
> origin    git@github.com:user/repo.git (push)
>
> If I commit to master in my desktop and run 'git push all master', the
> github and the server repos are correctly updated, but if I run 'git
> status' the message says:
>
> Your branch is ahead of 'origin/master' by 1 commit.
>   (use "git push" to publish your local commits)

But "all" and "origin" are different remotes. Just because you use the 
same URL does not make them the same remote repository from the view of 
your local repository.

(Additionally, "all" is not a special name, just in case you had 
expected that.)

> The message won't update unless I run git fetch or git push origin master.

Yes, that's how it is supposed to work.

I think there is some way to configure that a single push command pushes 
to several remote repositories, but I can't find it right now...

-- Hannes


```

## Garoe, 2016-07-12 08:44

Subject: Re: git push doesn't update the status with multiple remotes
Message-ID: <5784AE0B.2040709@gmail.com>
URL: https://gitlist.dev/e/5784AE0B.2040709%40gmail.com
In-Reply-To: <84c1ac72-cbe7-7490-2c61-9302703cb28b@kdbg.org>

```
Thanks for the quick reply.

On 12/07/16 06:26, Johannes Sixt wrote:
> Am 11.07.2016 um 18:54 schrieb Garoe:
>> I have a repository on github, a clone on my desktop and bare repo on a
>> private server, in my desktop the remotes looks like this
>>
>> all    git@github.com:user/repo.git (fetch)
>> all    git@github.com:user/repo.git (push)
>> all    user@server.com:user/repo.git (push)
>> server    user@server.com:user/repo.git (fetch)
>> server    user@server.com:user/repo.git (push)
>> origin    git@github.com:user/repo.git (fetch)
>> origin    git@github.com:user/repo.git (push)
>>
>> If I commit to master in my desktop and run 'git push all master', the
>> github and the server repos are correctly updated, but if I run 'git
>> status' the message says:
>>
>> Your branch is ahead of 'origin/master' by 1 commit.
>>   (use "git push" to publish your local commits)
>
> But "all" and "origin" are different remotes. Just because you use the
> same URL does not make them the same remote repository from the view of
> your local repository.

I expected git to be "intelligent" enough to detect that if the url are 
the same, it had already exchanged information with the server by the 
push command, so it would update the message without explicitly pushing 
to origin.

>
> (Additionally, "all" is not a special name, just in case you had
> expected that.)
>
>> The message won't update unless I run git fetch or git push origin
>> master.
>
> Yes, that's how it is supposed to work.

 From my point of view the current behaviour is counter-intuitive. 
Anyhow, I understand by your answer that the current behaviour is 
desired and it won't be changed.

> I think there is some way to configure that a single push command pushes
> to several remote repositories, but I can't find it right now...
>
> -- Hannes
>

Thanks again,
Garoe

```
