Git克隆网址与主机网址

时间:2018-02-09 10:49:20

标签: git proxy azure-devops git-bash http-proxy

我正在尝试使用Git-Bash将存储库克隆到服务器中的帐户。除了帐户“myvsaccount.visualstudio.com”之外,此服务器无法访问互联网。

克隆时,即使我使用整个网址“https://myvsaccount.visualstudio.com/Project/_git/repo/

wireshark和fiddler告诉我,克隆到上面的URL实际上击中了“myvsaccount.visualstudio.com”。所以我猜它应该有效。但是我得到了错误:

  

致命:无法访问   'https://myvsaccount.visualstudio.com/Project/_git/repo/':不能   解析主持人:myvsaccount.visualstudio.com

好像主机不存在或我没有访问权限。我是否必须打开服务器到互联网,现在打开所有克隆网址才能使用它?我认为我不需要这样做。

另外,我正在使用代理配置[System.Net.WebRequest] :: DefaultWebProxy = new-object System.Net,WebProxy($ proxyUri,$ true),但它没有帮助。

1 个答案:

答案 0 :(得分:0)

您应该配置Git以使用代理,命令配置为:

git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port

然后您可以再次克隆以检查它是否可以克隆成功。

更多详细信息,您可以参考Configure Git to use a proxyGetting git to work with a proxy server

相关问题