報錯如下
[root@test1 learngit]# git push -u origin master
ssh: connect to host github.com port 22: Connection refused
fatal: The remote end hung up unexpectedly
公鑰已經傳到github上的話,分析原因爲username沒有指定對
cat /root/.gitconfig
[user]
name = test
email = [email protected]
cat /root/.ssh/config
Host github.com
User test
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443
我的問題就是上面兩個用戶沒有一樣,改爲一樣後,測試成功
[root@test1 ~]# ssh -T [email protected]
The authenticity of host '[ssh.github.com]:443 ([192.30.253.123]:443)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[ssh.github.com]:443,[192.30.253.123]:443' (RSA) to the list of known hosts.