【问题标题】:Cannot push in git, Repository not found error无法推送 git,找不到存储库错误
【发布时间】:2016-04-27 00:47:31
【问题描述】:

我刚刚创建了一个新的 github 帐户,然后在我的 Windows 7 上安装了 GitHub。

我尝试使用我的命令行但是当我输入git 时说

git 未被识别为内部或外部命令。

我检查了路径,它是C:\Users\me\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe636a147ff3I,可以在该路径中找到cmd 文件夹。

但是,无论如何,为了避免散列,我开始使用 Git Shell。当我尝试做git push 时,我得到了

Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of know
n hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

authenticated 到 gitHub。我也有generated SSH 密钥,但是当我尝试将它添加到我在 gitHub.com 帐户中的 SSH 密钥中时,我得到了Key is already in use

所以,我不知道发生了什么。我已经尽力了,请帮助我。

谢谢

【问题讨论】:

  • 你有 git 遥控器吗?如果没有,请学习如何here
  • @intboolstring 我做了git remote add origin https://github.com/me/myproj.git,我得到了fatal: remote origin already exists.
  • 尝试运行git branch -a -vv(并告诉我结果)
  • 您的 github 帐户未按照远程 url 的建议通过 ssh 密钥进行身份验证。您正在使用密码身份验证。

标签: git github


【解决方案1】:

你有没有把本地文件夹加到git环境中,让它知道推送到哪里?

通常你会:

接下来的步骤取决于您是否想要将代码存储在一个新的在线存储库中或提取一个存储库。

拉是:

  • git pull origin master

推送将是:

  • git 添加。
  • git commit -m "原始提交"
  • git push origin master

【讨论】:

  • 我做了git clone https://github.com/me/myproj.git 而不是git remote add origin https://github.com/user/repo.git
  • 现在如果我这样做 git remote add origin https://github.com/me/myproj.git 我会得到 fatal: remote origin already exists.
  • git clone 默认添加远程到你的应用。你不需要在克隆后手动添加
【解决方案2】:

git clone 默认为你的应用添加远程。克隆后无需手动添加

git remote add origin git_url 

这里的 origin 只是作为 url 的别名。你可以随意命名它。 这用于将应用程序映射到 github。它用作地址。 默认情况下,通过 git clone 这个地址被添加到你的应用程序中。 要检查远程是否已添加到您的应用程序中,您可以使用

git remote -v

您还可以将多个遥控器添加到单个应用程序前。 github 和 heroku 都需要不同的 url 来推送代码。 在这个

git remote add origin git_url

git remote add heroku (heroku_url or git_url)

当我们将heroku和git添加到应用程序并运行时

git remote -v 

它显示两个远程网址 此外,如果远程 url 以 https 开头,请参阅密码身份验证,否则 ssh 身份验证。

【讨论】:

    【解决方案3】:

    感谢大家的宝贵时间。我所做的是首先我卸载了所有东西。

    然后

    在 gitgub.com 中创建一个新帐户

    下载并安装桌面版 github

    在 github 桌面上注销并使用您在 github.com 使用的用户名/密码再次登录(请参阅here

    转到 github.com,到您的帐户,复制您的普通电子邮件(gmail)并将其粘贴到 github 桌面上的“configure git”,将其粘贴到“nonreply git mail”(参见here

    打开 Git Shell,点击

    git config --global user.name "YOUR NAME"

    git config --global user.email "YOUR EMAIL ADDRESS"

    用于配置用户名/电子邮件 (见here

    现在可以在 Git Shell 中使用

    【讨论】:

      【解决方案4】:

      我有同样的问题,我的建议是在“git push origin master”之前输入“git remote set-url origin https://github.com/username/reponame

      【讨论】:

      • 避免仅链接的答案。除了链接之外,尝试包括您认为链接资源回答问题的原因,以防页面内容随时间变化或页面将来无法访问。
      猜你喜欢
      • 2021-03-11
      • 2021-01-08
      • 1970-01-01
      • 2021-06-07
      • 2011-03-14
      • 1970-01-01
      • 2012-04-15
      相关资源
      最近更新 更多