今天在提交代碼的時候:
ssh: connect to host github.com port 22: Connection refused fatal: 無法讀取遠程倉庫。 請確認您有正確的訪問權限並且倉庫存在。
英文:
ssh: connect to host github.com port 22: Connection refused fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
剛開始重啟IDEA,后來重啟虛擬機,再后來重啟電腦。百度上還有說是wifi問題,插了網線也無法解決。
后來找到了如下方法,解決問題,順利提交代碼:
ai@aiai:~$ vim .ssh/config
內容為:
Host github.com
User #################@qq.com (這個地方是寫github登陸時的用戶名)
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/Ai (私鑰地址)
Port 443
之后可以使用如下命令測試
ssh -T git@github.com
返回:Hi user1! You've successfully authenticated, but GitHub does not provide shell access. 則正常
若:ssh: connect to host github.com port 22: Connection refused 則需要檢查配置是否正確