Permissions 0644 问题
报错信息:
Permissions 0644 for '/XXX/.ssh/id_rsa.pub' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/xxx/.ssh/id_rsa.pub": bad permissions
xx@xx.cn: Permission denied (publickey).
fatal: Could not read from remote repository.
解决方法:
网上最多的说法是 chmod 400 ~/.ssh/id_rsa
但是其实我可能是使用了错的文件,.pub后缀的是公钥,如果你通过ssh客户端连接远程服务器,那么则需要为ssh客户端提供私钥。
可能在你的.ssh/config(或者 /etc/ssh_config)有如下一行
IdentityFile .../.ssh/vm/vm_id_rsa.pub
只需要删除.pub就行了
IdentityFile .../.ssh/vm/vm_id_rsa
能clone代码,但是ssh -T xxx@xxx.com失败(提示需要输入密码)
报错信息:
就我本人而言,报错提示为 输入USER@git.gitlab.com的密码, 但是其实根本没有这个账号,这里可能要输入的是秘钥, 我重新梳理了一遍流程,其实是忘记想ssh-agent中添加我生成的秘钥了,到.ssh目录下执行如下代码就可以了
ssh-add id_dsa