解决 github push failed (remote: Permission to userA/repo.git denied to userB.)
2017-07-24 13:50
1421 查看
解决 github push failed (remote: Permission to userA/repo.git denied to userB.)
【前言】当你看到这篇文章时,很高兴,你不用再去各大网站再去搜索这个问题的解决方案了,因为这篇文章可以帮你彻底解决问题。请耐心地阅读完。本文假设了两个用户 userA 和 userB ,userA的github项目名为 repo
当你在使用Android Studio push项目的时候,你遇到了这个问题:
Push failed: Failed with error: fatal: unable to access 'https://github.com/userA/repo.git/': The requested URL returned error: 403
报了403,说明访问被拒绝。
切换到终端(Terminal),使用命令 git push -u origin master 后,错误就更明显了:
remote: Permission to userA/repo.git denied to userB. fatal: unable to access 'https://github.com/userA/repo.git/': The requested URL returned error: 403
意思很明白,userB没有权限对userA的repo进行push更改。
这时你已经使用了如下命令去配置全局用户:
git config --global user.name userA git config --global user.email userA@Email.com
并且很明确当前用户已经是userA,但还是说userB没权限。。
什么原因?
由于该电脑使用git bash配过SSH,系统已经将指向github.com的用户设置为了userB,每次push操作的时候,都将读取到userB的用户信息,类似于记住密码。
如何解决?
1、对userA生成SSH公钥,添加到userB的github后台;
2、将userB添加为userA项目的contributer;
3、移除计算机中的userB。
对于1和2,相信很多人不想这么做,因为一旦使用了SSH,以后的所有clone、pull、push等操作都将使用SSH传输,对以往使用过https传输的项目也得重新更改传输方式,这样会浪费一些时间。
现在详细讲下3,操作很简单:
打开 控制面板–>用户–>证书管理–>系统证书
展开 git:https://github.com 并删除之。
好了,问题解决,现在去Android Studio 重新push,要求你输入userA的邮箱和密码,输入后就可以成功提交了。
最后查看重新生成了一个证书,并且未指定用户。
相关文章推荐
- GitHub "remote: Permission to account/somefile.git denied to account"
- git使用中遇到的remote:Permission to xxx denied to xxx问题如何解决
- git使用中遇到的remote:Permission to xxx denied to xxx问题如何解决报错403找不到的问题
- Git(GitHub) 005 添加SSH密钥 — 解决:Permission denied (publickey) fatal The remote end hung up unexpectedly
- git push -u origin master 出错 \Permission denied (publickey). fatal: Could not read from remote repo
- remote: Permission to xxxxx/javaeelzw.git denied to xxxx. fatal: unable to access 'https://git
- 解决mac电脑上出现Permission to xxx.git denied to xxx的问题
- github的Permission to xxx.git denied to user的问题
- remote: Permission to .git denied to user.
- remote: Permission to gituser/repositoryname.git denied to oldusername.
- 上传项目到github报错:Permission to xxx/xxx.git denied to xxxxxxx.
- Push local non-git project to remote github repo
- MACOS下解决git push error: Permission to XXX.git denied to XXX
- git push 到github时,报错:ERROR: Permission to xxx.git denied to sb.
- remote: Permission to repository_name.git denied to xxxx.
- github多用户提交错误Permission to repo denied to
- github 有名的问题【ERROR: Permission to .git denied to user】
- [Git]Error: Permission to user/repo denied to other-user
- Git推送错误Remote: User permission denied错误解决方法
- GitHub学习-----如何解决 error: failed to push some refs to git