Failed to connect to github.com port 443 after 21035 ms: Couldn’t connect to server解決辦法
1. 通過代理(網(wǎng)上都這么說,可是我失敗了)
網(wǎng)上都說什么通過代理解決這個問題。。。大概就是用下面的命令
git config --global http.proxy 127.0.0.1:59124
git config --global https.proxy 127.0.0.1:59124
注意后面的端口號要和本機(jī)開的代理一致,在這里 設(shè)置->網(wǎng)絡(luò)和Internet->代理 查看端口
我使用以后報錯:
Failed to connect to 127.0.0.1 port 59124 after 2030 ms: Couldn't connect to server
再次查找后,別人又說是因為我開了代理。。。。讓我用如下命令取消代理:
git config --global --unset http.proxy
git config --global --unset https.proxy
回到原點。。。。
2. 使用SSH
折騰的沒辦法,就詢問了gpt,它的回答是:
如果你正在使用HTTPS連接到GitHub,請嘗試改用SSH。你可以使用以下命令將遠(yuǎn)程URL從HTTPS切換到SSH:
git remote set-url origin git@github.com:username/repository.git
嘗試后,仍然報錯:
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
這個時候大概就是說ssh配置有問題,我重新走一遍這個配置,首先確保電腦安裝了git,然后git鼠標(biāo)右鍵應(yīng)該可以看到git bash的命令,打開這個窗口,使用如下命令生成密鑰:
ssh-keygen -t rsa -b 4096 -C "你的電子郵件地址"
它會讓你做一些選項,不用管,無腦回車,會在C:\Users\user下生成一個.ssh文件夾,里面會有兩個文件,可以使用notepad打開.pub文件,把里面的東西復(fù)制一下,粘貼到github中你的賬戶里,做法是:文章來源:http://www.zghlxwxcb.cn/news/detail-824403.html
- 點擊settings > SSH and GPG keys > New SSH key
把復(fù)制好的公鑰粘貼上去添加即可,然后后續(xù)再做push pull等操作應(yīng)該就能成功了文章來源地址http://www.zghlxwxcb.cn/news/detail-824403.html
到了這里,關(guān)于github 連接失敗問題解決的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!