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

相关文章
|
2月前
|
IDE 网络安全 开发工具
【Azure App Service】Local Git App Service的仓库代码遇见卡住不Clone代码的问题
【Azure App Service】Local Git App Service的仓库代码遇见卡住不Clone代码的问题
【Azure App Service】Local Git App Service的仓库代码遇见卡住不Clone代码的问题
|
2月前
|
开发工具 git
Git 中的 fork、branch 和 clone
【8月更文挑战第27天】
97 5
|
2月前
|
开发工具 git
【Azure App Service】App Service设置访问限制后,使用git clone代码库出现403报错
【Azure App Service】App Service设置访问限制后,使用git clone代码库出现403报错
|
2月前
|
开发工具 git Windows
解决git clone提示You hasn‘t joined this enterprise
解决git clone提示You hasn‘t joined this enterprise
122 2
|
2月前
|
开发工具 git iOS开发
服务器配置Huggingface并git clone模型和文件
该博客提供了在服务器上配置Huggingface、安装必要的工具(如git-lfs和huggingface_hub库)、登录Huggingface以及使用git clone命令克隆模型和文件的详细步骤。
113 1
|
2月前
|
开发工具 git
【Mac 系统】解决git clone速度慢
本文提供了解决Mac系统上使用git clone时速度慢的问题的方法。
110 0
|
4月前
|
开发工具 git
蓝易云 - 解决git clone时出现Failed to connect to 127.0.0.1 port 1573问题
希望这些信息能帮助你解决问题。如果问题仍然存在,可能需要检查你的网络设置或者联系你的网络管理员。
46 3
|
4月前
|
存储 开发工具 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”
|
3月前
|
开发工具 git
git clone如何拉取代码,抓取和拉取
git clone如何拉取代码,抓取和拉取
|
5月前
|
网络安全 数据安全/隐私保护
解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas
解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas
390 0