git - 远程:推送到 github 时权限被拒绝
问题描述
我有两个用户名 samwelnm2022 和 mchomvus4 的 github 帐户,我有工作要推送到用户名 mchomvus4 但是当我尝试从 git 推送时,我收到一条错误消息
remote: Permission to myRepositoryname.git denied to samwelnm2022.
fatal: unable to access 'https://github.com/myRepositoryname.git/': The requested URL
returned error: 403
我尝试使用 github Desktop 推动工作,并且工作正常
任何可以帮助我的人请
解决方案
使用错误的用户名意味着凭证缓存 ( git config credential.helper
) 已缓存与 samwelnm2022 关联的凭证github.com
。
如果您需要使用其他帐户进行一次推送,请尝试:
git push https://mchomvus4@github.com/<me>/<myRepo> master
这将强制为该特定推送使用不同的 GitHub 用户帐户。
推荐阅读
- php - PHP imagettftext 居中文本左、右、上、下
- php - 如何根据屏幕大小显示和提交两种表单之一?
- java - 如何为具有不同值的多个标记添加 infoWindowAdapters?
- c# - 是否可以在引用类型参数上模拟对象的方法设置值?
- java - 将数据从编辑文本传递到 Java 对象,
- javascript - 您将如何处理用户在 {prefix}reddit {subreddit} 中输入的位置(然后从该 subreddit 回复随机图像)
- jquery - 为什么我的成功功能被跳过?
- wordpress - 如何使用单选按钮更新结帐购物车以不征税?
- python-3.x - 如何在给定的网址(网站)上检查是否需要登录天气才能继续
- univocity - Univocity - 将单行解析为多个 bean