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

Using url.insteadOf in git-clone

From
PBPieter de Bie <pdebie@ai.rug.nl>
Date
Jun 27, 2008, 09:35 UTC
Message-ID
<27C25D70-0BFC-4362-A771-C7CAD89BC198@ai.rug.nl>
Hi,

I sometimes use url.insteadOf to create a shortcut to a central repository. For example, having something like[*1*]

[url "git://repo.or.cz/git/"]
	insteadOf = "repo:"

in my global gitconfig allows me to do a 'git fetch repo:dscho.git'. I'd also like to use that with git clone :). Currently if I try that, I get

Vienna:~ pieter$ git clone repo:dscho.git Initialize dscho/.git Initialized empty Git repository in /Users/pieter/dscho/.git/ ssh: Error resolving hostname repo: nodename nor servname provided, or not known fatal: The remote end hung up unexpectedly

Which I think comes from the fact that the global config isn't read in by remote.c when running git clone.

Now, I seem to remember there was a good reason for this (both builtin- clone and git-clone.sh have the same behaviour). Also, trying to quickly hack in something failed for me, even though it seems like a trivial change to make for someone more familiar with the code path.

Is there an easy fix for this?
- Pieter

[1] This is not really true. If I try that, I get an error: Vienna:git pieter$ git fetch -v repo:dscho.git fatal: I don't handle protocol 'it'

If I change the url to "ggit://.." it does work. It seems there is an off-by-one error somewhere? It does work for another url.insteadOf I have in my global config though..

Next: Johannes Schindelin
Message 1 of 26 in “Using url.insteadOf in git-clone”
  1. Pieter de BieJun 27, 2008
  2. 1/2 clone: respect the settings in $HOME/.gitconfig and /etc/gitconfigJohannes Schindelin, Jun 27, 2008
  3. 2/2 clone: respect url.insteadOf setting in global configsJohannes Schindelin, Jun 27, 2008
  4. Daniel BarkalowJun 27, 2008
  5. Pieter de BieJun 29, 2008
  6. Johannes SchindelinJun 29, 2008
  7. Daniel BarkalowJun 27, 2008
  8. Junio C HamanoJun 27, 2008
  9. Daniel BarkalowJun 29, 2008
  10. Junio C HamanoJun 29, 2008
  11. Johannes SchindelinJun 29, 2008
  12. Daniel BarkalowJun 29, 2008
  13. Johannes SchindelinJun 30, 2008
  14. Daniel BarkalowJun 30, 2008
  15. Junio C HamanoJun 30, 2008
  16. Daniel BarkalowJun 30, 2008
  17. Daniel BarkalowJun 30, 2008
  18. Johannes SchindelinJun 30, 2008
  19. Daniel BarkalowJun 30, 2008
  20. Junio C HamanoJun 30, 2008
  21. Junio C HamanoJun 30, 2008
  22. Jeff KingJun 30, 2008
  23. Junio C HamanoJun 30, 2008
  24. Johannes SchindelinJun 30, 2008
  25. Junio C HamanoJun 27, 2008
  26. Pieter de BieJun 29, 2008

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.