【问题标题】:GitHub Error Repository Not Found未找到 GitHub 错误存储库
【发布时间】:2012-06-15 20:34:46
【问题描述】:

尝试向 GitHub 添加一个用于 Rails 教程的空白示例应用程序,但我收到此错误(显然很常见,但我在其他帖子中搜索了解决方案,但找不到适合我的解决方案)。

ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

当我尝试 rails 教程的建议时,我都得到了错误:

$ git remote add origin git@github.com:<username>/sample_app.git
$ git push -u origin master

然后是我创建的 github 存储库说要尝试的非常相似的提示:

$ git remote add origin https://github.com/<username>/sample_app.git
$ git push -u origin master

我一直在 sample_app 目录中执行此操作,并且在提交之后:

$ git commit -a -m "Improve the README" 
(which is the last change I made and the only one before trying to push it to github)

帮助?

【问题讨论】:

  • git statusgit loggit remote -vgit branch -avv 的输出是什么?
  • 你定义了你的公钥吗?

标签: git github repository git-push


【解决方案1】:

在尝试推送之前,您需要先在 GitHub 上 create the repository。如果您无法推动工作,请尝试:

  1. 创建存储库。
  2. 从 GitHub 克隆新存储库。
  3. 在本地提交更改,然后推送。

克隆将正确设置您的遥控器,因此这通常是一种更简单的方法。

【讨论】:

  • 我做到了!它存在,这就是为什么我如此困惑。
  • git clone https://github.com/sashafklein/sample_app; cd sample_app; git remote -v 对我来说很好。
  • 那是什么意思?这是否意味着它有效并且我不需要做任何事情?或者我的电脑/我的 rails 安装有问题?
【解决方案2】:

发生这种情况的另一个原因是:当您连接到远程服务器时,未加载 ssh 密钥。为了解决这个问题,您可以在~/.ssh/config 中设置转发:

Host *
  ForwardAgent yes

这将确保当您从另一台服务器连接到 github 时,您的密钥保持加载状态。

【讨论】:

    【解决方案3】:

    在 Windows 机器上执行这些操作的一个奇怪的事情是 Windows 凭据管理器可以缓存您的 GitHub 用户名和密码,并且始终通过网络发送,即使您将 u/p 硬编码到网址。进入 Windows 凭据管理器并清除 GitHub 帐户凭据有时会有所帮助。

    遇到git fatal: repository not found 错误的其他五个常见原因包括:

    1. 您没有进行身份验证
    2. 您的密码已更改
    3. 您不是合作者
    4. 大小写不正确或单词拼写错误
    5. git 存储库已被删除

    【讨论】: