Git用户被锁定——-Clone failed: unable to access 'https://xx': The requested URL returned error: 403

一、 问题描述

gitpull/push 代码的时候提示:The Requested URL return error 403,这表示我们没有权限来pull/push相关代码

二、 问题分析

  • 有可能你是真的没有权限(认真脸)
  • 你修改了git仓库的用户名和密码,导致你内存和硬盘中缓存的账号密码不能使用

三、问题处理

方案1:

1、执行git config --list,查看git的配置信息

gitconfig.png

图中红色部分内容[user] 为你的git账号配置信息,[credential]为你的这些信息存储位置

2、执行vim .git-credentials,查看credential中缓存的账户

credential.png

2、 执行git help -a | grep credential,查看git的信息存储位置

cache.png

git help -a | grep credential命令查看自己系统支持的crendential, cache 代表内存中的缓存,store 代表磁盘。
git config credential.helper命令可以看到 cachestoreosxkeychain(钥匙串)中是否还有git的配置信息。由图中我们可以得出git config还存储在store

3、一般配置方法:

  • git config --global (--replace-all) user.name "你的用户名"
  • git config --global (--replace-all) user.email "你的邮箱"

4、如果上述步骤没有效果,我们就需要清除缓存(.gitconfig)

  • git config --local --unset credential.helper
  • git config --global --unset credential.helper
  • git config --system --unset credential.helper

具体介绍可以查看这里, 可能有多处.gitconfig文件

四、 重复输入用户名密码

清除缓存之后我们每次提交代码的时候都需要输入用户名和密码

  • git config --global credential.helper store

或者

  • 执行修改.gitconfig配置文件,把以下内容放置到最后

      [credential]
              helper = store  
    
  • 执行 vim .gitconfig查看

 

作者原文:Git The requested URL returned error: 403

方案2:

直接在本地计算机修改或者删除凭证即可:控制面板 / 所有控制面板项 / 凭据管理器

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值