在git中克隆远程存储库时无法解析主机github.com错误

我做了什么:我已经在Github上创建了一个远程仓库,并且我试图在本地机器上克隆远程仓库。 克隆时,我提供克隆URL&目标文件夹。

但每次我尝试克隆时,都会收到此错误:

错误:“致命:无法访问'https://github.com/hyperion057/spring-repo.git/':无法解析主机:github.com”

我需要做什么才能连接到GitHub?


我需要配置代理设置吗? 因为我的办公室有代理服务器。

是的,您可以通过设置HTTP_PROXYHTTPS_PROXY环境变量来实现。

请参阅“与github同步”:

set HTTPS_PROXY=http://<login_internet>:<password_internet>@aproxy:aport
set HTTP_PROXY=http://<login_internet>:<password_internet>@aproxy:aport
set NO_PROXY=localhost,my.company

请注意NO_PROXY ,以允许访问贵公司的内部网站

你也可以在你的git config中注册:

git config --global http.proxy http://<login_internet>:<password_internet>@aproxy:aport

我得到了类似的错误,这是由不正确的代理设置造成的。 这个命令救了我:

git config --global --unset http.proxy

https版本:

git config --global --unset https.proxy

另一种可能性,我自己遇到了这个问题。 但它是在我安装了一个VPN(这是无关和运行)后,

关闭VPN,解决了问题。

为了记录,我在MacBookPro上运行“Viscosity”VPN

链接地址: http://www.djcxy.com/p/4627.html

上一篇: could not resolve host github.com error while cloning remote repository in git

下一篇: Remote origin already exists on 'git push' to a new repository