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的时候你就发现可以成功了

相关文章
|
8天前
|
开发工具 git
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
25 3
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
|
28天前
|
网络安全 开发工具 git
mac git clone命令提示git@gitee.com: Permission denied (publickey).问题修复
mac git clone命令拉取gitee上项目代码时提示密钥问题
|
3月前
|
网络安全 开发工具 git
解决fatal:remote error:You can’t push to git://github.com/username/*.g
通过上述诊断与修复步骤,绝大多数的推送错误都能得到有效解决,确保您的Git工作流顺畅无阻。
299 1
|
4月前
|
Unix Shell 网络安全
git学习六:(bug总结)git@github.com: Permission denied (publickey).等
本文是关于解决在使用Git和GitHub时遇到的“git@github.com: Permission denied (publickey)”错误的指南。文章提供了详细的步骤,包括确认SSH Agent运行状态、检查密钥配置、确保密钥匹配、验证仓库URL、检查权限和代理设置,以及配置SSH文件。这些步骤帮助用户诊断并解决SSH认证问题。
509 0
|
8月前
|
存储 开发工具 git
解决“hint: the same ref. If you want to integrate the remote changes, usehint: ‘git pull‘ before pus”
解决“hint: the same ref. If you want to integrate the remote changes, usehint: ‘git pull‘ before pus”
183 3
|
27天前
|
Java 网络安全 开发工具
Git进阶笔记系列(01)Git核心架构原理 | 常用命令实战集合
通过本文,读者可以深入了解Git的核心概念和实际操作技巧,提升版本管理能力。
|
2月前
|
机器学习/深度学习 Shell 网络安全
【Git】Git 命令参考手册
Git 命令参考手册的扩展部分,包含了从基础操作到高级功能的全面讲解。
74 3
|
3月前
|
开发工具 git
git 常用命令
这些只是 Git 命令的一部分,Git 还有许多其他命令和选项,可根据具体需求进行深入学习和使用。熟练掌握这些命令能够帮助你更高效地管理代码版本和协作开发。
|
3月前
|
缓存 Java Shell
[Git]入门及其常用命令
本文介绍了 Git 的基本概念和常用命令,包括配置、分支管理、日志查看、版本回退等。特别讲解了如何部分拉取代码、暂存代码、删除日志等特殊需求的操作。通过实例和图解,帮助读者更好地理解和使用 Git。文章强调了 Git 的细节和注意事项,适合初学者和有一定基础的开发者参考。
75 1
[Git]入门及其常用命令
|
3月前
|
开发工具 git 开发者