【问题标题】:Unable to push to github: repository not found无法推送到 github:找不到存储库
【发布时间】:2017-08-22 20:38:42
【问题描述】:

每当我尝试从命令行将更改推送到远程 github 存储库时,都会收到以下错误:

> git push
remote: Repository not found.
fatal: repository 'https://github.com/MyOrg/MyRepo.git' not found

(我已经替换了 org 和 repo 名称,但它们绝对是正确的名称)。

我已检查我对存储库有写访问权。我可以通过github 网站创建分支并写入文件,并将这些更改拉回本地。

我正在使用Git Credential Manager for Windows (GCM) 向 github 进行身份验证,我在 gitconfig 中有以下内容:

[credential]
    helper = manager

我在 Windows 10 上运行,git 版本 2.10.2.windows.1。

【问题讨论】:

  • 你看过这个吗? stackoverflow.com/questions/10116373/… 他们建议将用户名添加到网址中,例如:myusername@github.com/path_to/myRepo.git
  • 您是否使用git init 正确初始化了本地git repo 并添加了远程git remote add origin https://github.com/user/repo.git?对不起,如果这很明显
  • @SvinSimpe 该仓库是从 github 克隆的,如果我运行 git remote show origin,它看起来都设置正确。
  • @SebastianBerge 尝试了git remote set-url origin https://username@github.com/path_to_myRepo.git,但仍然设置了未找到存储库错误。

标签: windows git github


【解决方案1】:

您需要指定要推送到哪个分支。

-git push origin branchName

GitHub Docs: Pushing to a remote

【讨论】:

    【解决方案2】:

    当您第一次cd 进入本地存储分支的目录时,您是否尝试过使用 SvinSimpe 建议的命令?

    【讨论】:

    • 是的,我是从目录中运行命令的。我现在已经整理好了,会发布一个回复,以防其他人也遇到它。
    【解决方案3】:

    在我的情况下,问题出在 Git 凭据管理器上,我通过控制面板 > 用户帐户 > 凭据管理器 > Windows 凭据从 Windows 中删除了保存的凭据。下次我尝试推送它时会弹出一个对话框,提示输入 github 用户名和密码。在输入这些时,它似乎已经整理好了。

    【讨论】:

    • 谢谢!在与这个问题斗争了几个小时后,这为我解决了。
    猜你喜欢
    • 2021-01-08
    • 2021-11-27
    • 2021-09-28
    • 2012-08-25
    • 2012-04-28
    • 2018-05-02
    • 2011-12-09
    • 2019-06-18
    • 2023-03-03
    相关资源
    最近更新 更多