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

Re: Why doesn't git-fetch obey -c "remote.origin.url" on the command-line?

From
Jeff King <peff@peff.net>
Date
Jun 13, 2014, 07:51 UTC
Message-ID
<20140613075110.GH7908@sigill.intra.peff.net>
In-Reply-To
<CACBZZX4MyaOKkCvTSKhZtyRMFvpBMiMGz2ix3OxMz_s=P-=p=w@mail.gmail.com>
On Fri, Jun 13, 2014 at 09:37:07AM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 17 quoted lines
> On a git built from the master branch just now:
> 
>  $ ./git config remote.origin.url
> https://code.google.com/p/git-core/
> $ ./git -c remote.origin.url=git://git.sourceforge.jp/gitroot/git-core/git.git
> config remote.origin.url
> git://git.sourceforge.jp/gitroot/git-core/git.git
> $ GIT_TRACE=1 ./git -c
> remote.origin.url=git://git.sourceforge.jp/gitroot/git-core/git.git
> fetch 2>&1 | head -n 2
> trace: built-in: git 'fetch'
> trace: run_command: 'git-remote-https' 'origin'
> 'https://code.google.com/p/git-core/'
> 
> I'd expect this to try to fetch from the remote.origin.url I specified
> on the command-line, but for some reason fetch doesn't pick that up.
> Isn't this a bug?
I think this is an alternate version of the report in [1].

The short answer is: remote.*.url is a multi-valued config option, and you can only append to (not override) such options with "git -c". Try using insteadOf.

-Peff
[1] http://article.gmane.org/gmane.comp.version-control.git/250427
Previous: Ævar Arnfjörð BjarmasonNext: Philip Oakley
Message 2 of 3 in “Why doesn't git-fetch obey -c "remote.origin.url" on the command-line?”
  1. Ævar Arnfjörð BjarmasonJun 13, 2014
  2. Jeff KingJun 13, 2014
  3. Philip OakleyJun 16, 2014

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.