Git 克隆 URL 对比宿主 Url
Git cloning URL vs Host Url
我正在尝试使用 Git-Bash 将存储库克隆到我在服务器中的帐户。除了帐户 "myvsaccount.visualstudio.com" 之外,此服务器无法访问互联网。
克隆时,即使我使用整个 url "https://myvsaccount.visualstudio.com/Project/_git/repo/"
wireshark 和 fiddler 告诉我克隆到上面的 URL 实际上命中了 "myvsaccount.visualstudio.com"。所以我猜它应该工作。但我收到错误:
fatal: unable to access
'https://myvsaccount.visualstudio.com/Project/_git/repo/': Could not
resolve host: myvsaccount.visualstudio.com
好像主机不存在或者我没有访问权限。我是否必须将服务器打开到 Internet,现在对所有克隆 URL 开放才能工作?我认为我不需要那样做。
此外,我正在使用代理配置 [System.Net.WebRequest]::DefaultWebProxy = new-object System.Net,WebProxy($proxyUri, $true),但它没有帮助。
你应该配置Git使用代理,命令配置为:
git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
然后再克隆一次,看看是否能克隆成功。
更多详情,可以参考Configure Git to use a proxy and Getting git to work with a proxy server。
我正在尝试使用 Git-Bash 将存储库克隆到我在服务器中的帐户。除了帐户 "myvsaccount.visualstudio.com" 之外,此服务器无法访问互联网。
克隆时,即使我使用整个 url "https://myvsaccount.visualstudio.com/Project/_git/repo/"
wireshark 和 fiddler 告诉我克隆到上面的 URL 实际上命中了 "myvsaccount.visualstudio.com"。所以我猜它应该工作。但我收到错误:
fatal: unable to access 'https://myvsaccount.visualstudio.com/Project/_git/repo/': Could not resolve host: myvsaccount.visualstudio.com
好像主机不存在或者我没有访问权限。我是否必须将服务器打开到 Internet,现在对所有克隆 URL 开放才能工作?我认为我不需要那样做。
此外,我正在使用代理配置 [System.Net.WebRequest]::DefaultWebProxy = new-object System.Net,WebProxy($proxyUri, $true),但它没有帮助。
你应该配置Git使用代理,命令配置为:
git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
然后再克隆一次,看看是否能克隆成功。
更多详情,可以参考Configure Git to use a proxy and Getting git to work with a proxy server。