【问题标题】:Can't sync local git master to existing git hub remote repository无法将本地 git master 同步到现有的 git hub 远程存储库
【发布时间】:2017-09-23 04:40:42
【问题描述】:

我目前有一个学校项目的本地 git master,该项目已上传到 github 帐户。然后我使用 github online 将我的存储库转移到第二个 github 帐户(出于专业原因,我正在重新命名)。效果很好。

新问题是有两个 GitHub 远程存储库。我删除了第一个 GitHub 存储库,然后添加了第二个,但是当我尝试时

git push --set-upstream origin master

我很快被告知:

remote: Permission to *****/****.git denied to myOldUserAccount.
fatal: unable to access 'https://github.com/*****/****.git/': The requested URL returned error: 403

我觉得这是 GitHub 的登录问题。我如何授权我的第二个帐户处理我的第一个帐户的事务?我所有的搜索都只返回了Logout and login as another user git bash,这在这种情况下没有帮助。

【问题讨论】:

    标签: git bash authentication github multiple-accounts


    【解决方案1】:

    无法访问您的远程存储库,请检查您的 .git/config 文件 并检查

    url = https://github.com/username/yourrepositoryname.git
    

    是正确的? 如果 url 正确但仍然出现错误,则可以在 url 中添加密码。

    url = https://username:password@github.com/username/yourrepositoryname.git
    

    我认为它有效。

    【讨论】:

    • 谢谢,这很有帮助!
    猜你喜欢
    • 1970-01-01
    • 2011-09-16
    • 2018-03-14
    • 1970-01-01
    • 2020-09-23
    • 2014-10-19
    • 1970-01-01
    • 1970-01-01
    • 2018-10-29
    相关资源
    最近更新 更多