git 使用 push 提交到远程仓库出现 The requested URL returned error: 403 错误

摘要:

记录了使用push提交到远程仓库出现 The requested URL returned error: 403 错误的解决方法。

问题描述

  • 电脑已经注册过一个 github 帐号,一直在本机使用,配置过 SSH。
  • 新建另一个 github 帐号,本地建立好项目之后,使用命令:$ git push -u origin master 时出现以下错误:
remote: Permission to yeqing123/Thinking_in_Java.git denied to yeqing1234.
fatal: unable to access 'https://github.com/yeqing123/Thinking_in_Java/': The requested URL returned error: 403

问题原因

问题主要出在原注册账号上,系统保存了账号的信息。在使用新帐号时,信息不一致,所以报错。

解决方案

  1. 打开cmd,输入命令:rundll32.exe keymgr.dll,KRShowKeyMgr,出现系统存储的用户名和密码窗口;
  2. 将 github 相关的条目删除;
  3. 重新执行命令:$ git push -u origin master,提示输入账户名及密码后,出现如下提示,提交成功。
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 8 threads
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 2.25 KiB | 461.00 KiB/s, done.
Total 10 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
remote: This repository moved. Please use the new location:
remote:   https://github.com/yeqing123/Thinking_in_java.git
To https://github.com/yeqing123/Thinking_in_Java
   4ef7080..cd28b65  master -> master

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值