git报错:Please make sure you have the correct access rights and the repository exists

今天在用vscode上 push更新到gitee上时报错Please make sure you have the correct access rights and the repository exists,原来是ssh key有问题,连接不上服务器,这里记录一下解决办法。

原因是我可能在企业的gitee上删掉了自己的另一个git账号。导致没权限访问和提交。

1. 重新在git设置一下身份的名字和邮箱

cmd|powershell| bash进入要提交的目录下,然后

git config --global user.name "yourname"

git config --global user.email“your@email.com"

注:yourname是你要设置的名字,your@email是你要设置的邮箱。

2. 删除.ssh文件夹(直接搜索该文件夹)下的known_hosts,删除。

.ssh文件在C盘里面的。把known_hosts删除。

3. git bash输入命令

ssh-keygen -t rsa -C "your@email.com"(请填你设置的邮箱地址)

就像这样,然后一直回车就行了

 打开C盘文件

 

id_rsa是私钥,要保管好,id_rsa.pub是公钥,复制里面的内容

4. 打开giuhub进行配置

右上角图标-> settings-> SSH and GPG keys

5. 重新push,就可以成功了。 

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值