【问题标题】:Unable to create git submodule - remote: Not Found无法创建 git 子模块 - 远程:未找到
【发布时间】:2019-04-18 03:24:07
【问题描述】:

使用 git bash 创建 git 子模块时,出现以下错误

$ git submodule add  https://github.com/******/my-repo/my-app 
Cloning into 'D:/my-repo/my-app'...
remote: Not Found
fatal: repository 'https://github.com/*******/my-repo/my-app/' not found
fatal: clone of 'https://github.com/*******/my-repo/my-app' into submodule path 'D:/my-repo/my-app' failed

下面是我的 .git/config 文件

$ cat .git/config
[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
[remote "origin"]
        url = https://github.com/*******/my-repo.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

我能够从 github 克隆 my-repo,但是当我在克隆后尝试添加子模块时,我看到了这个错误。我是否应该在 github 中为 my-app 子模块单独创建一个 repo,以便能够将其作为子模块添加到另一个 repo (my-repo) 中?

或者,我在这里缺少任何配置吗?

PS:我关注的是这个链接 - https://git-scm.com/book/en/v2/Git-Tools-Submodules

【问题讨论】:

    标签: git github git-submodules


    【解决方案1】:

    我是否应该在 github 中为 my-app 子模块单独创建一个 repo,以便能够将其作为子模块添加到另一个 repo (my-repo) 中

    是的。

    https://github.com/******/my-repo/my-app 不是要克隆的 Git 存储库的 URL。
    它是现有存储库的子文件夹的 URL(即:https://github.com/*******/my-repo.git)。

    在自己的存储库中拥有myapp 是能够将其作为子模块添加到另一个存储库的先决条件。

    【讨论】:

      猜你喜欢
      • 2017-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-25
      • 1970-01-01
      • 2012-03-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多