Git提交错误:Permission denied (publickey),fatal: Could not read from remote repository

错误提示:

Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

Git提交错误:Permission denied (publickey),fatal: Could not read from remote repository_第1张图片
image.png

沃德天,谁动我电脑了,昨天还好好的~~~~~

昨天->操作过id_rsa_pub文件

是谁???这么不要脸

好像是我。。。

好吧重新配置下公钥:

执行:ssh-keygen -t rsa -C “邮箱地址”

image.png

然后出现: Enter file in which to save the key (/Users/wyd/.ssh/id_rsa):(公钥名称,默认是 id_rsa.pub)

之前连接别的重新生成了id_rsa.pub,就是没有写名字一路回车爽啊,之前的id_rsa.pub被新的覆盖了,之后杯具就是无法连接git了

所以我们这里写test(我是随便起的,你们随意)

image.png

然后一路回车吧

来看生成的文件:

image.png

最后关键的一步:将自己起的名字加入到ssh中

ssh-add ~/.ssh/test

然后复制test.pub内容到git的ssh文件中,这样就妥了

插曲:记得去掉文件的换行,怎么换——>google

你可能感兴趣的:(Git提交错误:Permission denied (publickey),fatal: Could not read from remote repository)