git Permission denied?

hades
  • 57

将秘钥文件拷贝到.ssh文件夹下了,但为什么一直是这样的结果:

The authenticity of host '[rsgerrit]:29418 ([xx.xx.xx.xx]:29418)' can't be established.
RSA key fingerprint is SHA256:46TAh8mcOaToX5JD81qkcyRrP66+Xq9cps7RXkKblYQ.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[rsgerrit]:29418,[xx.xx.xx.xx]:29418' (RSA) to the list of known hosts.
Load key "/home/hades/.ssh/id_rsa": Permission denied
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

git的ssh key一直不生效,为什么?

回复
阅读 1.9k
1 个回答
✓ 已被采纳

一种可能的情况是权限问题,看下是对应的权限

# 检查文件与目录权限是否与下面一致    
chmod 755 /home/hades
chmod 700 /home/hades/.ssh
chmod 600 /home/hades/.ssh/*

# 检查ssh_config和sshd_config配置
IdentityFile ~/.ssh/id_rsa
PubkeyAuthentication yes
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏