git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

2023-02-13,,,,

当我们拿到一天别人用的电脑,里面是上一位前辈的git ssh key,这时候我们要自己改,改完之后上传代码到远程repository时,

可能会报git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

解决方案:

删除当前key,然后重新生成key:

$ ssh-keygen -t rsa -C "你的GitHub注册邮箱"

将本机生成的ssh key复制到个人GitHub账户中去。

本机账户文件夹下找到id_rsa.pub,以text方式打开,复制内容。

打开GitHub,登陆个人账户,添加ssh key

再去执行:

$ git push -u origin master

完美上传。

git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.的相关教程结束。

《git@github.com: Permission denied (publickey). fatal: Could not read from remote repository..doc》

下载本文的Word格式文档,以方便收藏与打印。