git error: You are not allowed to push code to a protected branch on this project 解决

一、问题

git push代码时出现:

You are not allowed to push code to a protected branch on this project.

二、问题解决

1. 确定代码自己是有权限的(上传哪个分支就需要具有分支权限。如果没有master权限是不能推送到master分支的)

2.一般情况下需要清空git代理

# 全局:查看 Git 代理

git config --global --get http.proxy

# 全局:删除 Git 代理

git config --global --unset http.proxy

3.上述办法均无效时,我把git存储的账号密码清空之后,解决问题

查看是否缓存:

git config credential.helper

如果你的电脑本来就有.gitconfig文件, 找到下面这句话删除,保存退出。

[credential]   helper = xxx

如果输入了 git config credential.helper 命令之后还是出现了osxkeychain, store 或者 cache 等,可以使用一下命令参看电脑中所有存在git credential配置的文件。

git config --show-origin --get credential.helper
找到对应的文件之后。上传对应的 : credential.helper = XXXX

参考文章

git 的密码删除和重新配置可以参考下面这篇文章:

点击打开链接




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值