鍍金池/ 問答/Linux/ git Permission denied?

git Permission denied?

將秘鑰文件拷貝到.ssh文件夾下了,但為什么一直是這樣的結(jié)果:

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一直不生效,為什么?

回答
編輯回答
祈歡

一種可能的情況是權(quán)限問題,看下是對應(yīng)的權(quán)限

# 檢查文件與目錄權(quán)限是否與下面一致    
chmod 755 /home/hades
chmod 700 /home/hades/.ssh
chmod 600 /home/hades/.ssh/*

# 檢查ssh_config和sshd_config配置
IdentityFile ~/.ssh/id_rsa
PubkeyAuthentication yes
2018年7月13日 05:25