推送到远程存储库时,“无法连接到github.com端口443:连接超时”

我已经“搜索”和“堆栈溢出”太多了,但是我还没有找到解决问题的方法。

我在Ubuntu上,第一次尝试 git。

我做到了:

sudo apt-get install git

并在网站上创建了一个帐户(并验证了电子邮件,一切正常)。然后我

git config --global user.name "<my_name_here>"

git config --global user.email "<my_email_here>"

然后,我访问了网站并创建了一个名为gittest的公共存储库(我没有使用README进行初始化,也没有添加许可证或.gitignore)。然后我

mkdir gittest

在我的桌面上

cd /Desktop/gittest

然后:

echo "# gittest" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/<my_username>/gittest.git

最后

git push -u origin master

这就是悲剧: 在写完git push -u origin master之后单击Enter,它什么也不做,并且在很多秒后返回错误消息:

  

致命:无法访问'https://github.com/ / gittest.git /':无法连接到github.com端口443:连接超时

  • 我该如何解决?请帮助

编辑

如果我

echo "$http_proxy"

echo "$https_proxy"

什么也没有发生(终端向我返回了一个空行)。

potatoIII 回答:推送到远程存储库时,“无法连接到github.com端口443:连接超时”

也许您在代理后面,您需要进行以下配置:

http.proxy

覆盖通常使用http_proxy,https_proxy和all_proxy环境变量配置的HTTP代理(请参见curl(1))。除了curl可以理解的语法外,还可以使用用户名而不指定密码来指定代理字符串,在这种情况下git将尝试以与获取其他凭据相同的方式获取一个。有关更多信息,请参见gitcredentials(7)。因此,语法为[protocol://] [user [:password] @] proxyhost [:port]。可以逐个远程覆盖它;参见remote..proxy

完美!

要解决“无法连接到github.com端口443:超时”消息,我们需要运行:

git config --global http.proxy

http://domain.local \用户名:password @ proxyServer:8080

其中用户名是您在代理中的用户名,密码是您的密码

完成!您可以运行git config --global http.proxy

来检查设置是否已应用

其他信息:

git config

脚本编写愉快!

本文链接:https://www.f2er.com/3118241.html

大家都在问