解決ssh: connect to host 107.21.95.3 port 22: Connection timed out

在Git Shell下輸入命令測試剛纔的公鑰是否認證正確時

~$ ssh Git@github.com 

總是報下面的錯誤:

ssh: connect to host github.com port 22: Connection timed out

下面是我找到的解決辦法。

首先,我們需要在.ssh目錄下創建一個config文件,輸入如下內容:

Host github.com 
User xxx@qq.com (你註冊github時的郵箱,這裏使用註冊的用戶名也行) 
Hostname ssh.github.com 
PreferredAuthentications publickey 
IdentityFile ~/.ssh/id_rsa 
Port 443 

可以把以上內容拷到config文件裏面,注意修改你的郵箱,保存並關閉 。
進行測試是否連接上github.com

PC:~/.sshcd PC:  ssh -T git@github.com 
Warning: Permanently added ‘[ssh.github.com]:443,[207.97.227.248]:443’ (RSA) to the list of known hosts. 
Hi zhou411424! You’ve successfully authenticated, but GitHub does not provide shell access. 

出現Hi xxx!……表示連接成功。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章