[Git]Please make sure you have the correct access rights and the repository exists

这个问题是这样,需要在已有github账号的A机器上,再创建一个github账号,新账号创建完毕,将代码通过机器A push上之后,再另一台机器B,clone 这个项目时报出了如下错误:

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

解决方式是:

在clone代码的时候要使用https的形式。

https://github.com/accountName/projectname.git

另外,在机器A上配置两个git账户,需要重新生成sshkey,并且要将这两个github账户的ssh文件进行区分 id_rsa_old / id_rsa_new ,其次要通过配置文件对这两个账号进行配置,在使用的时候切换比较方便。

类似的教程,网上资源很多,多参考几个文档即可。 

原文地址:https://www.cnblogs.com/mrdooo/p/7435050.html