最近参加了一个在线编程课程,要求我们将家庭作业上传到 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
Run Code Online (Sandbox Code Playgroud)
rheros是我用来推送家庭作业的存储库的名称。显然,现在我不再使用rheros了,但命令行认为我仍在尝试推动它。我尝试检查我是否有错误的 SSH 密钥,但一切看起来都很好。
如何让我的命令行有效地忘记我之前推送到的完全不相关的目录的存在?
编辑
git remote --verbose给出:
origin https://github.com/my-github-username/mygithubrepo.git (fetch)
origin https://github.com/my-github-username/mygithubrepo.git (push)
Run Code Online (Sandbox Code Playgroud)
到目前为止,下面的建议都没有帮助我:似乎rherosrepo 正在我的命令行后台运行,我不知道如何消除它。
小智 5
首先检查当前的 git 存储库是什么,如果有的话,使用:
git remote -v
Run Code Online (Sandbox Code Playgroud)
然后,通过检查 github 网站并复制正确的存储库 url 来确认您的新存储库存在
通过运行覆盖存储库 url:
git remote add origin https://github.com/my-github-username/mygithubrepo.git
Run Code Online (Sandbox Code Playgroud)
再次尝试 git push:
git push origin master
Run Code Online (Sandbox Code Playgroud)
做
git remote add origin https://github.com/my-github-username/mygithubrepo.git
Run Code Online (Sandbox Code Playgroud)
然后再次尝试推送
| 归档时间: |
|
| 查看次数: |
8260 次 |
| 最近记录: |