Permission denied (publickey). fatal: Could not read from remote repository.

git clone [email protected]:XXXX/XXXXX.git
Cloning into 'XXXXX'...
Permission denied (publickey).
fatal: Could not read from remote repository.

 

解决方案:

git config --global user.name "yourname"

git config --global user.email "youremail"

ssh-agent bash

ssh-add id_rsa

主要是密钥没有加入到ssh中,尤其是刚部署的新服务器时,会发生此情况。

需要将密钥添加到ssh:ssh-add 文件名[如果id_rsa设置密码,输入密码即可]。

如果ssh-add不成功,请先 ssh-agent bash后在 ssh-add 即可。
 

 

你可能感兴趣的:(mac,or,linux,命令)