一、
注意事项:
(1)公钥文件权限设置问题 现象: Permissions 0644 for '/Users/arunyang/.ssh/id_rsa_ele_me.pub' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. 解决: chmod 600 /Users/arunyang/.ssh/id_rsa_ele_me.pub (2)IdentityFile本地~/.ssh/config应该为私钥,不应该问公钥 现象: Load key "/Users/arunyang/.ssh/id_rsa_ele_me.pub": invalid format git@git.elenet.me: Permission denied (publickey). 解决:IdentityFile配置中把.pub的公钥后缀给去掉 (3)ssh配置的git@host主机名,出现如下情况,证明是ok的 ssh -T git@git.elenet.me Welcome to GitLab, arunyang! (4)ssh配置参考 Host git.elenet.me Hostname git.elenet.me IdentityFile /Users/arunyang/.ssh/id_rsa_ele_me PreferredAuthentications publickey User arunyang
参考:https://www.jianshu.com/p/4b56bed47e6e