解决 github push failed (remote: Permission to userA/repo.git denied to userB.)
来源:互联网 发布:网络集成商 编辑:程序博客网 时间:2024/05/16 08:23
解决 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 userAgit 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的邮箱和密码,输入后就可以成功提交了。
- 最后查看重新生成了一个证书,并且未指定用户。
阅读全文
0 0
- 解决 github push failed (remote: Permission to userA/repo.git denied to userB.)
- GitHub "remote: Permission to account/somefile.git denied to account"
- Push local non-git project to remote github repo
- github如何解决failed to push some refs to git
- git push 到github时,报错:ERROR: Permission to xxx.git denied to sb.
- MACOS下解决git push error: Permission to XXX.git denied to XXX
- [Git]Error: Permission to user/repo denied to other-user
- git使用中遇到的remote:Permission to xxx denied to xxx问题如何解决
- remote: Permission to repository_name.git denied to xxxx.
- git push -u origin master 出错 \Permission denied (publickey). fatal: Could not read from remote repo
- 【已解决】github中git push origin master出错:error: failed to push some refs to
- 解决git error: failed to push some refs to 'git@github.com:
- 如何解决failed to push some refs to 'git@github.com:mail/file.git'
- Git push error: Unable to unlink old (Permission denied)
- error: failed to push some refs to 'git@github.com:....." Updates were rejected because the remote c
- remote: Permission to xxxxx/javaeelzw.git denied to xxxx. fatal: unable to access 'https://git
- GitHub学习-----如何解决 error: failed to push some refs to git
- 解决-adb pull failed remote permission denied
- OData demo
- 关于文本标签的使用
- 面试题_Selenium
- ThinkPHP3.2自带的七牛云配置使用
- js查看浏览器类型和版本
- 解决 github push failed (remote: Permission to userA/repo.git denied to userB.)
- 1115. Counting Nodes in a BST (30)
- Discuz X3.2 论坛关闭后,MySQL帖子导出为.csv
- 机器学习之数学基础(概率与统计推断、矩阵、凸优化)
- 步步紧逼!英特尔至强E7 v3对决IBM POWER8
- LeetCode#109. Convert Sorted List to Binary Search Tree
- Zookeeper集群搭建(涵盖命令详解)与Error contacting service. It is probably not running的问题解决
- Android匿名共享内存和MemoryFile
- C语言:列举system函数如何修改控制台背景及文字颜色