簡體   English   中英

推送到遠程存儲庫時“無法連接到 github.com 端口 443:連接超時”

[英]"Failed to connect to github.com port 443: Connection timed out" when pushing to remote repository

我已經“谷歌搜索”和“stackoverflowed”了這么多,但我還沒有找到解決我的問題的方法。

我在 Ubuntu 上,第一次嘗試 git。

我做了:

sudo apt-get install git

並在網站上創建了一個帳戶(並驗證了email,一切正常)。 然后我

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后單擊回車,它什么也沒做,在(很多)秒后它返回一條錯誤消息:

致命:無法訪問“ https://github.com//gittest.git/ ”:無法連接到 github.com 端口 443:連接超時

  • 我該如何解決? 請幫忙

編輯

如果我

echo "$http_proxy"

或者

echo "$https_proxy"

沒有任何反應(終端返回一個空行)。

也許你在代理后面,你需要配置:

http.proxy

覆蓋 HTTP 代理,通常使用 http_proxy、https_proxy 和 all_proxy 環境變量進行配置(請參閱 curl(1))。 除了 curl 可以理解的語法之外,還可以指定一個帶有用戶名但沒有密碼的代理字符串,在這種情況下 git 將嘗試以與其他憑據相同的方式獲取一個代理字符串。 有關更多信息,請參閱 gitcredentials(7)。 因此語法是 [protocol://][user[:password]@]proxyhost[:port]。 這可以在每個遠程的基礎上被覆蓋; 見遠程..代理

完美的!

為了解決“無法連接到 github.com 端口 443:超時”消息,我們需要運行:

git 配置 --global http.proxy

http://domain.local \username:password@proxyServer:8080

其中用戶名是您在代理中的用戶名,密碼是您的密碼

完畢。 您可以檢查設置是否應用運行 git config --global http.proxy

附加信息:

git config

快樂的腳本!

嘗試運行以下命令

git config --global --unset https.proxy

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM