github - 无法 git 推送到 Github
问题描述
我在 Github 网站上创建了一个新的 Github 存储库,然后 git 在我的本地机器上克隆了它。在本地进行一些更改后,我提交了更改并尝试将其推送到远程仓库,但它失败并显示以下消息:
Learn.NET git:(master) git push
ERROR: Permission to GITHUB_ACCOUNT1/Learn.NET.git denied to GITHUB_ACCOUNT2.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
上下文:我有两个 Github 帐户,我在 GITHUB_ACCOUNT1 上创建了这个 repo,但不知何故它试图使用我的 GITHUB_ACCOUNT2 帐户凭据来推送,我怎样才能让自己在这个目录中可以推送?
我已经在本地机器上配置了 ssh。
解决方案
我自己整理的。
这个命令起到了神奇的作用:
git remote set-url origin https://github.com/GITHUB_ACCOUNT1/Learn.NET.git
在此之后,我能够 git push 到远程。
推荐阅读
- c - 字符串链表的插入排序
- java - 如何修改 REST API 的 Spring 存储库搜索的页面类型结果?
- android-studio - 如果我已经拥有 Intellij IDEA Ultimate,是否需要安装 Android Studio?
- c# - 使用 Razor 视图在 Asp.net Mvc 中动态添加和编辑数据
- button - 如何定位按钮内图标的不透明度(不影响整个按钮)?
- html - 为什么之前加载脚本和 CSS 标签
? - c - 使用 jpegtran 旋转渐进式 jpeg:顺序 jpeg 的 SOS 参数无效
- c# - 多个列表迭代
- javascript - Jquery On() 'click' 处理所有事情?
- javascript - 如何通过 javascript 取消服务器请求?(不是 AJAX)