git clone之报错git@gitee.com:Permission denied (publickey).fatal: Could not read from remote repository

简介: git clone之报错git@gitee.com:Permission denied (publickey).fatal: Could not read from remote repository

很多小伙伴们在git clone下载资源的时候会出现如下的错误:

$ git clone git@gitee.com:chen-xuerun/uniapp.git

Cloning into 'uniapp'...

git@gitee.com: Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

大家会想为什么呢?明明我的仓库地址没问题怎么会下载资源错误呢。这其实是因为没有配置正确的公钥导致没有权限操作。

解决办法:

1.查看自己是否生成过公钥public key

cat ~/.ssh/id_rsa.pub

如果以前生成过,则是以ssh-rsa开头以邮箱结尾的。

那我这里为什么报错呢,是因为我并没有将公钥加入配置到gitee里面。如果你也是这个问题,直接将密钥加入到gitee里面即可,如果没有密钥则继续往下看生成。

2. 生成公私钥

ssh-keygen -t rsa -C “xxxxx@xxxxx.com”

这里的xxxxx@xxxxx.com是你自己的账号邮箱。 生成后找到对应的文件夹将.puh文件用记事本打开,把里面的内容复制。

3.将public key添加到gitee

打开自己的Gitee的设置–>ssh公钥

4.验证是否可以成功

5.然后继续再clone项目,就可以成功了

git clone 你的项目仓库的SSH地址

再次clone的时候你就发现可以成功了

相关文章
|
4月前
|
安全 网络安全 开发工具
百度搜索:蓝易云【git无法使用git协议clone github仓库问题解决方法】
通过尝试以上解决方法,你应该能够解决无法使用Git协议克隆GitHub仓库的问题。选择适合你网络环境和要求的方法,并根据需要进行相应的配置。
185 2
|
1月前
|
开发工具 git
Git -- 代码上传错误 error: failed to push some refs to ‘git@gitee.com:JMFive/uni-shop2.git‘
Git -- 代码上传错误 error: failed to push some refs to ‘git@gitee.com:JMFive/uni-shop2.git‘
|
2月前
|
网络安全 开发工具 git
git修改提交路径以及强制提交——异常:error: remote origin already exists.与异常:error: failed to push some refs to的解决
git修改提交路径以及强制提交——异常:error: remote origin already exists.与异常:error: failed to push some refs to的解决
20 0
|
6天前
|
算法 Java BI
云效产品使用报错问题之平台上导出的统计数据和 git 中使用命令导出的数据统计都对不上,如何解决
本合集将整理呈现用户在使用过程中遇到的报错及其对应的解决办法,包括但不限于账户权限设置错误、项目配置不正确、代码提交冲突、构建任务执行失败、测试环境异常、需求流转阻塞等问题。阿里云云效是一站式企业级研发协同和DevOps平台,为企业提供从需求规划、开发、测试、发布到运维、运营的全流程端到端服务和工具支撑,致力于提升企业的研发效能和创新能力。
|
8天前
|
开发工具 git
git 拉取代码仓库代码报错(合并错误 refusing to merge unrelated histories)
git 拉取代码仓库代码报错(合并错误 refusing to merge unrelated histories)
18 0
|
8天前
|
开发工具 git
完美解决git 执行git push origin master指令 报错command not found
完美解决git 执行git push origin master指令 报错command not found
17 0
|
4月前
|
存储 前端开发 开发工具
git clone -mirror 和 git clone 的区别
git clone -mirror 和 git clone 的区别
|
1月前
|
开发工具 git
git报错 Unable to create ‘D:/project/xxx/.git/index.lock‘: File exists.
git报错 Unable to create ‘D:/project/xxx/.git/index.lock‘: File exists.
84 1
|
2月前
|
开发工具 git
Git:error: remote origin already exists
Git:error: remote origin already exists
22 2
|
3月前
|
开发工具 数据安全/隐私保护 git
git报错: git: not authorized :未经授权解决办法
git报错: git: not authorized :未经授权解决办法
79 0