Johannes Schindelin  committed bc0c0d8

clone: respect url.insteadOf setting in global configs

When we call "git clone" with a url that has a rewrite rule in either
$HOME/.gitconfig or /etc/gitconfig, the URL can be different from
what the command line expects it to be.

So, let's use the URL as the remote structure has it, not the literal
string from the command line.

Noticed by Pieter de Bie.

Signed-off-by: Johannes Schindelin <>
Acked-by: Daniel Barkalow <>
Signed-off-by: Junio C Hamano <>

  • Participants
  • Parent commits 7ac749c
  • Branches master

Comments (0)

Files changed (1)

File builtin-clone.c

 		refs = clone_local(path, git_dir);
 	else {
 		struct remote *remote = remote_get(argv[0]);
-		struct transport *transport = transport_get(remote, argv[0]);
+		struct transport *transport =
+			transport_get(remote, remote->url[0]);
 		if (!transport->get_refs_list || !transport->fetch)
 			die("Don't know how to clone %s", transport->url);