Publickey issues of Github push


$ git push origin master
Warning: Permanently added the RSA host key for IP address '192.30.252.129' to t
he list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

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

------or------

$ git push origin master
Permission denied (publickey).
fatal: Could not read from remote repository.

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

It is caused by the user not adding his user.name and user.email. Sometimes even I does that with git config, it still appears. I have to manually added them to the git config file.

Sometimes it appears if I used git url in the git remote. After I changed the git url to the https url, it works. 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
当在使用Git命令时出现"Permission denied (publickey)"错误时,通常有两种可能的原因。首先,这个错误可能是由于客户端和服务端未生成或配置正确的SSH key所致。其次,可能是由于客户端和服务端的SSH key不匹配引起的。 要解决这个问题,首先要确保在客户端和服务端都生成了正确的SSH key,并将公钥添加到GitHub账户的SSH keys中。可以使用以下命令生成SSH key: ``` ssh-keygen -t rsa -b 4096 -C "your_email@example.com" ``` 然后将生成的公钥(位于用户目录下的`.ssh`文件夹中的`id_rsa.pub`文件)添加到GitHub账户的SSH keys中。 如果已经生成了SSH key,并且公钥也已添加到GitHub账户中,但仍然出现"Permission denied (publickey)"错误,那么可能是由于客户端和服务端的SSH key不匹配。可以通过以下步骤来解决这个问题: 1. 检查客户端和服务端的SSH key是否匹配。可以使用以下命令来检查: ``` ssh -T git@github.com ``` 如果显示"Hi username! You've successfully authenticated, but GitHub does not provide shell access.",则表示SSH key匹配。如果显示"Permission denied (publickey)",则表示SSH key不匹配。 2. 如果SSH key不匹配,可以尝试重新生成客户端和服务端的SSH key,并将公钥添加到GitHub账户的SSH keys中。 通过以上步骤,应该能够解决GitHub出现"Permission denied (publickey)"错误的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [github和Coding使用Git出现:Permission denied (publickey).解决办法](https://blog.csdn.net/SOLar7SysteM/article/details/125723884)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [解决git@github.com: Permission denied (publickey). Could not read from remote repository](https://blog.csdn.net/qq_37185371/article/details/103302004)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值