码迷,mamicode.com
首页 > 其他好文 > 详细

My solution for Git Client Error: Permission denied (publickey)

时间:2017-02-19 20:16:40      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:ref   开发   make   set   github   配置信息   16px   error   origin   

在使用Git客户端的过程中遇到的问题以及解决方案分享。

我之前已经安装Git客户端并且使用Git开发过公司项目,也已经正确生成PublicKey并且添加到SSH keys on github of my account,但是当我想从github上克隆另一个客户端push的代码的时候一直报错:

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

Please make sure you have the correct access rights
and the repository exists.

在开发公司项目的时候完全没有遇到什么权限问题,应该是之前使用Git的过程中做了某些配置导致的这个问题,运行 git config --global --list 命令Check全局配置信息

git config --global --list

发现remote.origin.url和remote.gerrit.url配置的远程仓库是之前公司的github仓库地址,在全局配置里将其清除

git config --global --unset remote.origin.url
git config --global --unset remote.gerrit.url

重新克隆仓库一切正常!!!

一般情况下,每个具体项目的远程仓库都配置在 localRepo/.git/config中,也可以cd到localRepo通过命令 git config --list查看。

Git使用,按照git-scm.com上的步骤,即使遇到问题也也肯定都有解决方案,我这次遇到的问题比较措手不及而已。

My solution for Git Client Error: Permission denied (publickey)

标签:ref   开发   make   set   github   配置信息   16px   error   origin   

原文地址:http://www.cnblogs.com/title/p/6416520.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!