Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting git insteadof in command line

Tags:

git

Because of the poor network connection. I built some git repository mirrors to open source software.

$ cat ~/.gitconfig

[url "git://127.0.0.1/chromiumos"]
    insteadOf = "https://chromium.googlesource.com"
[url "git://127.0.0.1/chromiumos"]
    insteadOf = "https://boringssl.googlesource.com"
[url "git://127.0.0.1/chromiumos"]
    insteadOf = "https://pdfium.googlesource.com"
[url "git://127.0.0.1/chromiumos"]
    insteadOf = "https://weave.googlesource.com"

I want to made such configuration by typing command line, so remove them first:

git config --global --unset url.git://127.0.0.1/chromiumos.insteadof

Then add them again:

git config --global url.git://127.0.0.1/chromiumos.insteadof https://boringssl.googlesource.com
git config --global url.git://127.0.0.1/chromiumos.insteadof https://chromium.googlesource.com
git config --global url.git://127.0.0.1/chromiumos.insteadof https://pdfium.googlesource.com
git config --global url.git://127.0.0.1/chromiumos.insteadof https://weave.googlesource.com

But the result is not what I expected, only one config is take effect:

$ git config -global -l

url.git://127.0.0.1/chromiumos.insteadof=https://weave.googlesource.com
like image 859
tthsn Avatar asked Mar 23 '16 06:03

tthsn


1 Answers

As noted in the git config documentation:

Multiple lines can be added to an option by using the --add option.

That is, after setting the first one, you need --add for the remainder so that they do not simply replace the first. (You can use --add on the first one too, of course.)

like image 180
torek Avatar answered Nov 01 '22 03:11

torek