拉代碼時報錯:
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
解決方案一:
將代碼克隆或拉取路徑由git@改為https://即可,但對網(wǎng)絡環(huán)境有要求。
解決方案二:(推薦)
根據(jù)github官方建議將22端口改為443端口(https://help.github.com/en/github/authenticating-to-github/using-ssh-over-the-https-port)
1.先切換到~/.ssh/路徑下,window為C:\Users\{用戶名}\.ssh下,再創(chuàng)建全名為config的文件
? 文件內(nèi)容為文章來源:http://www.zghlxwxcb.cn/news/detail-503501.html
Host github.com
Hostname ssh.github.com
Port 443
2.保存后運行ssh -T git@github.com命令看,是否配置成功。期間有可能會提示更新文件信息,全選yes或y文章來源地址http://www.zghlxwxcb.cn/news/detail-503501.html
到了這里,關(guān)于解決github拉取代碼時訪問失敗的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!