【问题标题】:why can I not add an upstream git repo?为什么我不能添加上游 git repo?
【发布时间】:2018-11-08 05:14:18
【问题描述】:

我拿了一个 master 的 fork 并且 master 收到了一些更新,同时我现在想把它拉到我的 fork 中。所以我所做的是: 将分叉克隆到本地磁盘, 进入目录并使用git remote add upstram http://xx.xxx.xxx.xxx:pppp/path/to.git 将主服务器添加为上游存储库。然后git fetch upstream 给了我:

fatal: 'upstream' does not appear to be a git repository
fatal: Could not read from remote repository.

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

而且我的磁盘上也确实有该主存储库的克隆,因此我确定具有读取权限。这里有什么问题?

谢谢!

【问题讨论】:

    标签: git master upstream-branch


    【解决方案1】:

    很抱歉以这种方式回复,但我无法发表评论。

    您是否注意到您的命令是: git 远程添加 upstram http://xxx.xxx.xxx.xxx:pppp/path/to.git

    “上游”不是“上游”?

    我相信这可能是问题所在......

    如果您还不熟悉该命令,请运行“git remote -v”查看遥控器。

    【讨论】:

      【解决方案2】:

      我认为您想将本地 git 存储库与远程存储库连接起来,这是我的建议,考虑使用:git remote set-url origin [your remote git repo url] 这是为了更改您的 git 远程存储库链接参考。

      对于新的本地 git 存储库,您应该使用:git remote add origin [your remote git repo url]

      希望对你有帮助。

      【讨论】:

        【解决方案3】:

        在您的命令中添加您命名为 upstram 的遥控器,而不是 upstream。检查遥控器的名称:git remote show

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-07-22
          • 2013-09-01
          • 1970-01-01
          • 2020-10-06
          • 1970-01-01
          • 2013-06-11
          相关资源
          最近更新 更多