正确生成秘钥并在Github添加公钥后通过以下命令测试SSH
ssh -T git@github.com
git@github.com's password:
Permission denied, please try again.
git@github.com's password:
输入密码无效;
解决办法:
vim ~/.ssh/config
#添加
Host github.com
identityFile ~/.ssh/id_rsa#自己的私钥文件名
Host github.com
Hostname ssh.github.com
Port 443
User git
再次测试:
ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '[18.141.90.153]:443' to the list of known hosts.
Hi xxxxx! You've successfully authenticated, but GitHub does not provide shell access.
来源:Using SSH over the HTTPS port - GitHub Docs