git中的错误解决1--You do not have permission to push to the repository via HTTPS

在git版本控制中,经常会遇到权限问题,我在提交代码的时候就经常会踩这个坑,下面就讲讲遇到的这个问题,用过哪些解决方案和最终的解决方案

一、错误场景

将本地库push推送到远程库的时候,会出现remote: You do not have permission to push to the repository via HTTPS错误

  • 错误截图


在处理这个问题的时候,产生过很多种解决方案,以下是尝试过的解决方案(可以参看此博客https://blog.csdn.net/Burgess_Lee/article/details/100848614):

1. 处于新环境下需要重新设置你的用户名和邮件
git config --global user.name "your name"
git config --global user.email "your eamil"
2. 切换HTTPS模式或SSH模式

当我尝试了上面两种方案后,都没有解决这个问题,后面才发现是因为本地记录了凭证的原因

二、最终解决方案

1. 进入到控制面板,点击用户账户和家庭安全
2. 点击管理windows凭证
3. 在这里会存放你的gitee和github的凭证,在这里你可以删除凭证,也可以添加凭证将你的凭证添加进去
4. 以上操作执行完以后,便可以实现push推送了

你可能感兴趣的:(git中的错误解决1--You do not have permission to push to the repository via HTTPS)