gpt4 book ai didi

github - git push 推送到错误的仓库

转载 作者:行者123 更新时间:2023-12-04 03:30:07 24 4
gpt4 key购买 nike

最近参加了一个在线编程类(class),要求我们将家庭作业上传到 Github,从那时起,每当我输入 git push -u origin master我得到:

remote: Permission to my-github-username/mygithubrepo.git denied to rheros.
fatal: unable to access 'https://github.com/my-github-username/mygithubrepo.git/': The requested URL returned error: 403
rheros是我用来推送家庭作业的存储库的名称。显然,现在我没有使用 rheros不再,但命令行认为我仍在尝试插入它。我尝试检查我是否有错误的 SSH key ,但一切看起来都很好。

如何让我的命令行有效地忘记我之前推送到的完全不相关的目录的存在?

编辑 git remote --verbose给出:
origin  https://github.com/my-github-username/mygithubrepo.git (fetch)
origin https://github.com/my-github-username/mygithubrepo.git (push)

到目前为止,以下建议都没有帮助我:似乎 rheros repo 正在我命令行后台的某个地方运行,我不知道如何消除它。

最佳答案

首先检查当前的 git 存储库是什么,如果有的话,使用:

git remote -v

然后,通过检查 github 网站并复制正确的存储库 url 来确认您的新存储库存在

通过运行覆盖存储库 url:
git remote add origin https://github.com/my-github-username/mygithubrepo.git

再次尝试 git push:
git push origin master

关于github - git push 推送到错误的仓库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31977100/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com