git 错误“无法连接到 github.com”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14198158/
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 07:59:24  来源:igfitidea点击:

Error "Failed connect to github.com"

linuxgitgithub

提问by vinay patel

I am a beginner to start with git. I have created my account on github. I created a new repository. But I am not able to push or update changes in github using the terminal. I am running the following commands:

我是一个初学者,从 git 开始。我已经在 github 上创建了我的帐户。我创建了一个新的存储库。但我无法使用终端推送或更新 github 中的更改。我正在运行以下命令:

mkdir ~/TestApplication
cd ~/TestApplication
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin https://github.com/vinayptl/TestApplication.git
git push origin master

When I execute last command git push origin master, it freezes for some time and give following error:

当我执行 last command 时git push origin master,它会冻结一段时间并出现以下错误:

error: Failed connect to github.com:443; Connection timed out while accessing 
https://github.com/vinayptl/TestingApplication.git/info/refs

fatal: HTTP request failed

I am working on Linux Platform. What could be the problem? I have seen some of the answers from SO but not able to resolve this issue.

我在 Linux 平台上工作。可能是什么问题呢?我已经看到了 SO 的一些答案,但无法解决此问题。

回答by VonC

If you have a proxy in place, ping won't help you much (it cannot ping through proxy).

如果您有代理, ping 不会对您有太大帮助(它无法通过代理 ping)。

You need to set http_proxyand https_proxyenvironment variable.
See:

您需要设置http_proxyhttps_proxy环境变量。
看: