問題描述:
在使用Git將本地倉庫推送到遠(yuǎn)程倉庫的時(shí)候,發(fā)生了如下錯(cuò)誤:“fatal: Could not read from remote repository.”
1、首先輸入以下命令檢查SSH是否能夠連接成功(ssh后面有空格)
ssh -T git@github.com
發(fā)現(xiàn)報(bào)錯(cuò):端口連接超時(shí)。
ssh: connect to host github.com port 22: Connection timed out
解決方案(親測有效)
在C盤——用戶——你的主機(jī)名文件夾中找到.ssh文件夾;(此前配置SSH時(shí)會(huì)生成該文件夾)
在.ssh文件夾中新建文件 config,不帶后綴(可以新建文本文檔,去掉.txt后綴)
使用notepad++(或其他方式)打開config文件,輸入以下內(nèi)容,保存后即可
其中xxxxqq.com為你的郵箱
Host github.com
User xxxxqq.com
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443
再次執(zhí)行
ssh -T git@github.com
會(huì)出現(xiàn)以下提示,輸入yes回車即可文章來源:http://www.zghlxwxcb.cn/news/detail-808389.html
The authenticity of host '[ssh.github.com]:443 ([192.30.255.123]:443)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[ssh.github.com]:443,[192.30.255.123]:443' (RSA) to the list of known hosts.
再次執(zhí)行ssh -T git@github.com,發(fā)現(xiàn)驗(yàn)證通過–接下來可以正常上傳代碼文章來源地址http://www.zghlxwxcb.cn/news/detail-808389.html
Hi Clare! You've successfully authenticated, but GitHub does not provide shell access.
到了這里,關(guān)于ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repo的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!