【问题标题】:remote: Repository not found error in mac terminal远程:在 mac 终端中找不到存储库错误
【发布时间】:2020-12-24 07:19:30
【问题描述】:

我是 git 新手。我有一个私人仓库,现在我想将本地仓库的更改推送到远程仓库。但是,我收到一个错误:

remote: Repository not found.
fatal: repository 'https://github.com/co-csp/csm.git/' not found

什么可能导致这些错误,请帮助我如何解决它, 我正在使用 Mac 终端。我在 github 个人资料中的用户名是 john2 git config user.namegit config user.username 都给出了 john2 所以用户名似乎正确...

【问题讨论】:

  • 1.你可以访问这个 repo 吗? 2) 你确定网址没有拼写错误吗?
  • 是私有仓库吗?您输入的凭据是否正确?

标签: git github git-push git-remote


【解决方案1】:

如果您使用的是私有存储库,请执行以下操作:

  1. git 远程 rm 来源
  2. git 远程添加源 https://user@github.com/co-csp/csm.git
  3. git clone https://user@github.com/co-csp/csm.git

这应该会提示您输入 GitHub 密码,并且应该如下所示。

正在克隆到“csm”... 'https://user@github.com' 的密码:

【讨论】:

    【解决方案2】:

    这里有两个选择。一种选择是使用git clone,另一种选择是git init

    选项 1:使用git clone。在一个新的空文件夹中输入以下命令: git clone https://github.com/co-csp/csm.git。你准备好了。

    选项 2:在项目文件夹中,键入 git init。这将启动一个空的新存储库。它将在里面创建一个.git 文件夹。通过键入cd .git 转到此文件夹。用你最喜欢的编辑器打开config 文件(我的是vim)。您将在那里看到以下内容:

    [core]
            repositoryformatversion = 0
            filemode = true
            bare = false
            logallrefupdates = true
            ignorecase = true
    

    在下面,附加以下内容:

    [remote "origin"]
            url = https://github.com/co-csp/csm.git
            fetch = +refs/heads/*:refs/remotes/origin/*
    

    【讨论】:

    • 如果 GitHub 返回 404 为什么会有帮助?
    • 公平点。 OP 是否真的在 github 中创建了存储库?
    【解决方案3】:

    出现Repository not found错误有两种可能:

    1. 远程存储库不存在。 如果您已经设置了远程 URL,请通过键入 $ git remote -v 来显示它,并检查您是否正确拼写了所有内容。如果您尚未添加远程 URL,请尝试使用$ git remote add origin [URL] 来添加。还要确保你可以在 github 上找到 repo;也许所有者将其删除或重命名。要在本地更新远程存储库的 URL,请键入 $ git remote set-url origin [new-URL]。之后,输入$ git remote show origin,检查git现在是否可以找到远程仓库。

    2. 远程存储库是私有的,您无权访问。如果存储库是私有的并且您没有正确验证,即使您的远程存储库 URL 正确,git 也会给您Repository not found 错误。通常,您可以使用 SSH 密钥或 HTTPS 进行身份验证。使用 HTTPS,git 通常会在需要时提示您输入凭据。如果没有,请尝试通过键入 $ git remote rm origin 删除对远程存储库的本地引用,然后使用 $ git remote add origin [URL] 重新添加它。我个人更喜欢使用带有公钥和私钥的 SSH 身份验证,因为它不一定需要任何密码。您可以查看this link 为您的 GitHub 设置 SSH 身份验证,或者直接在 google 上进行验证。

    【讨论】:

      猜你喜欢
      • 2014-03-01
      • 2016-10-15
      • 2012-09-27
      • 2019-10-24
      • 1970-01-01
      • 2012-06-09
      • 2015-07-19
      • 2021-05-05
      • 1970-01-01
      相关资源
      最近更新 更多