【问题标题】:How do I resolve this issue of preventing push to origin wrt. GitHub?如何解决这个阻止推送到原点的问题。 GitHub?
【发布时间】:2011-08-02 10:40:01
【问题描述】:

当我尝试使用 Git 将我的应用程序推送到 GitHub 时,我得到以下信息:

$ git push origin master
Enter passphrase for key '/c/Users/Medicine - SWEng/.ssh/id_rsa':
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

运行git remote -v的输出:

$ git remote -v
heroku  git@heroku.com:young-rain-273.git (fetch)
heroku  git@heroku.com:young-rain-273.git (push)
origin  git@github.com:SWEngineer7sample_app.git (fetch)
origin  git@github.com:SWEngineer7sample_app.git (push)
sample  git@github.com:SWEngineer/sample_app.git (fetch)
sample  git@github.com:SWEngineer/sample_app.git (push)

我该如何解决这个问题?

【问题讨论】:

  • 你能做一个git remote -v 并将输出粘贴到这里吗?
  • 可能是配置的网址有问题。 “git remote show origin”对于获取和推送 url 显示什么?
  • 您似乎没有正确设置您的 RSA 密钥;检查 githut 设置文档;

标签: git github


【解决方案1】:

错误信息很清楚(并且正确):

错误:未找到存储库。

问题是origin 设置为git@github.com:SWEngineer7sample_app.git 这肯定是错误的。很明显,你没有按SHIFT-7,而是进入repo路径时只按7,所以有一个7 应该有一个 /。只是一个错字。

origin 应该与sample (git@github.com:SWEngineer/sample_app.git) 定义相同,然后 GitHub 也会找到一个 repo。

为了解决这个问题,

git remote rm origin
git remote add origin git@github.com:SWEngineer/sample_app.git

【讨论】:

    【解决方案2】:

    如果您尝试推送到您没有推送权限的存储库,您也可能会收到“错误:未找到存储库”。如果错误更清楚会很好,但如果(例如)您正在推送到其他人的仓库,请与所有者核实以确保您具有推送访问权限。

    根据Help.GitHub - Remotes

    首先,您需要一个可以推送到的 GitHub 上的存储库。要么创建一个新的 repo,获得其他人 repo 的协作者权限,要么 fork 别人的 repo。您只能推送到 git@github.com:user/repo.git 之类的 ssh URL 或 https://user@github.com/user/repo.git 之类的 https URL。如果您使用只读 URL 克隆了另一个 repo,您​​可以为您的 URL 添加第二个远程,或者删除或重命名现有的远程。

    【讨论】:

      【解决方案3】:

      您有一个公钥问题。使用没有密码的密钥,并在制作时在提示输入时按 Enter 键。

      使用带有-vvvv 参数的 ssh 到 GitHub 存储库,以查看提供的 SSH 密钥。

      【讨论】:

      • 如果是公钥问题,错误可能会改为“权限被拒绝(公钥)。”
      猜你喜欢
      • 2022-07-28
      • 2011-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-21
      • 2014-10-07
      • 1970-01-01
      相关资源
      最近更新 更多