I am running the following git clone
command:
git clone http://gitlab.example.com/project/component.git
But I get this error:
Cloning into 'component'...
fatal: repository 'https://gitlab.example.com/project/component.git/' not found
As you can see, git is trying to clone the HTTPS url, which does not exist. Is there any configuration to disable this behavior?
p.s. I trying the following command:
$ git config --global url.http://gitlab.example.com/.insteadOf https://gitlab.example.com/
And here is the content of ~/.gitconfig
file:
[http]
sslverify = false
[url "http://gitlab.example.com/"]
insteadOf = https://gitlab.example.co
But I am still getting the same error when running git clone
.
P.S.2: I am running this command in a docker container based on the jessie debian image. Could this be the source of the problem?
答案 0 :(得分:0)
Try to override default protocol for the URL:
$ git config --global url.http://gitlab.example.com/.insteadOf https://gitlab.example.com/
答案 1 :(得分:0)
问题是在docker容器中/etc/resolv.conf
中设置的DNS:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
search example.com
nameserver 8.8.8.8
nameserver 8.8.4.4
所以我将本地gitlab的IP添加到以下文件中:
/ etc / hosts
192.168.20.112 gitlab.example.com
问题已解决。