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

Re: pushing remote branches

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 16, 2009, 20:05 UTC
Message-ID
<7vlji6p75y.fsf@alter.siamese.dyndns.org>
In-Reply-To
<hdrr1e$oub$1@ger.gmane.org>
Lorenzo Bettini <bettini@dsi.unifi.it> writes:
Show 14 quoted lines
>> Anyway to answer your question, I do not see the refspec line as the issue
>> here, but the URL for the repo, which determines how you access it.
>
> so this would have been enough:
>
>>> [remote "origin"]
>>>            fetch = +refs/heads/*:refs/remotes/origin/*
>>>            url = git://...
>>> [branch "master"]
>>>            remote = origin
>>>            merge = refs/heads/master
>>> [branch "experiments"]
>>>            remote = origin
>>>            merge = refs/heads/experiments

Because "git://" is almost always read-only, you wouldn't be able to push back to the origin with that configuration. If you are only following the project that is perfectly fine.

Otherwise, either use "git@..." in remote.origin.url to use git-over-ssh in both directions, or you can use pushurl if you have recent enough version of git, like:

    [remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git://...
        pushurl = git@...

When you primed your repository with "git clone git://...", it would be nice if "clone" added a "corresponding" pushurl for you. But ... part of the two lines are often different, depending on how hosting site is organized, so unfortunately "clone" cannot do so.

Previous: Lorenzo Bettini
Message 6 of 6 in “pushing remote branches”
  1. Lorenzo BettiniNov 14, 2009
  2. Sitaram ChamartyNov 15, 2009
  3. Lorenzo BettiniNov 15, 2009
  4. Sitaram ChamartyNov 15, 2009
  5. Lorenzo BettiniNov 16, 2009
  6. Junio C HamanoNov 16, 2009

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.