[email protected]: Permission denied (publickey).fatal: Could not read from remote repository

本文详细介绍了在使用Git向远程仓库推送代码时遇到“Permission denied(publickey)”错误的解决方案。通过生成SSH密钥并将其添加到GitHub账户,确保拥有正确的访问权限。此外,文章还强调了正确配置Git用户邮箱的重要性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用 git 将本地库推送到远程库上,使用如下语句

$ git push -u origin master

但是出现下列提示

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

fatal: Could not read from remote repository 

Pleasemake sure you have the correct access rights and the repository exists.

解决办法:https://blog.csdn.net/chaoyueziji123/article/details/54669555

主要是使用 ssh-keygen -t rsa -C “邮箱地址” 生成 id_rsa.pub文件,将文件内容复制到SSH keys即可.

所以在使用git前准确配置自己的邮箱是有必要的

git config –global user.name “yourname”
git config –global user.email “youremail”

 

 

 

 
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值