git 无法连接到 github.com 端口 443:操作超时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38663299/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:09:04  来源:igfitidea点击:

Failed to connect to github.com port 443: Operation timed out

gitgithub

提问by HsuChihYung

git clone https://github.com/RubyLouvre/avalon
Cloning into 'avalon'...
fatal: unable to access 'https://github.com/RubyLouvre/avalon/': Failed to connect to github.com port 443: Operation timed out

I can not use https to clone any repo,but I can clone them by SSH.

我不能使用 https 来克隆任何 repo,但我可以通过 SSH 克隆它们。

git clone [email protected]:RubyLouvre/avalon.git
Cloning into 'avalon'...
remote: Counting objects: 33102, done.
remote: Compressing objects: 100% (44/44), done.

What is the problem with this?Even I set proxy,but it is still not working.I try much of Network environment,but it make no sense.

这是什么问题?即使我设置了代理,但它仍然无法正常工作。我尝试了很多网络环境,但没有任何意义。

回答by Anand Soni

If you are using proxy for network connection, then you will have to add proxy to git config file. Use the below command to add proxy.

如果您使用代理进行网络连接,那么您必须在 git 配置文件中添加代理。使用以下命令添加代理。

git config --global http.proxy http[s]://username:password@proxyipaddress:portnumber