报错如下
[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.