git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: branch.<name>.pushremote not working with push.default simple or upstream

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 7, 2013, 15:47 UTC
Message-ID
<7v8v2lvs5s.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALkWK0miONv_O67SHcfJoXq1x7xPvKu6uefg+TiPGbF-1WJ-bg@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 14 quoted lines
> [+CC: jc, jk]
>
> Leandro Lucarella wrote:
>> I changed branch.master.remote to upstream and set
>> branch.master.pushremote to origin, but when I do I git push I get an
>> error:
>>
>> $ git push --dry-run --verbose
>> fatal: You are pushing to remote 'origin', which is not the upstream of
>> your current branch 'master', without telling me what to push
>> to update which remote branch.
>
> Yes, this is a defect: both remote.pushdefault and
> branch.<name>.pushremote suffer from it.

The upstream and simple modes have been defined to push to "upstream" repository in central-shared-repository workflow.

At this point in Leandro's example, I think the configuration is:
	[branch "master"]
		remote = upstream
                merge = refs/heads/master
                pushremote = origin
and master@{u} == upstream's master, not origin's.

This shows the "triangular" support in 1.8.3 is only half-finished; the other half was discussed a few weeks ago ($gmane/224604), but I do not recall what the current status of the topic is. I personally think 'single' the root level of the thread hints is an overkill mechanism, so here is a suggestion to show one possible way forward.

Until the branch.$name.push mechanism is introduced to specify which destination branch is updated by the push, and/or branch.$name.push is not specified after such a mechanism is introduced, I think the natural extension of the current end-user configuration would be to redefine "upstream" mode to push to update the branch with the same name (in the above example, 'master' of 'origin' is updated), when the "repository that is pushed to, which is different from the repository that is fetched from" is specified via remote.pushdefault or branch.$name.pushremote mechanisms.

This incidentally covers "simple" mode, because "pushing to update the branch with the same name" is the only behaviour accepted by the mode anyway.

When branch.$name.push mechanism is introduced and the user uses it, then "upstream", "simple", or any other setting for that matter would be ignored. With

	[branch "master"]
		remote = upstream
                merge = refs/heads/master
                pushremote = origin
		push = refs/heads/master

it is clear that "git push" while on 'master' should push to origin to update its master branch.

Previous: Ramkumar RamachandraNext: Leandro Lucarella
Message 3 of 9 in “branch.<name>.pushremote not working with push.default simple or upstream”
  1. Leandro LucarellaJun 7, 2013
  2. Ramkumar RamachandraJun 7, 2013
  3. Junio C HamanoJun 7, 2013
  4. Leandro LucarellaJun 7, 2013
  5. Ramkumar RamachandraJun 7, 2013
  6. Leandro LucarellaJun 7, 2013
  7. Ramkumar RamachandraJun 7, 2013
  8. Ramkumar RamachandraJun 7, 2013
  9. Junio C HamanoJun 7, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.