无法创建 git 子模块 - 远程:未找到
Unable to create git submodule - remote: Not Found
使用 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:我在关注这个 link - https://git-scm.com/book/en/v2/Git-Tools-Submodules
Should I create a repo for my-app submodule separately in github to be able to add it as a submodule in another repo (my-repo)
是的。
https://github.com/******/my-repo/my-app
不是要克隆的 Git 存储库的 URL。
它是现有存储库的子文件夹的 URL(即:https://github.com/*******/my-repo.git
)。
在自己的存储库中拥有 myapp
是能够将其作为子模块添加到另一个存储库的先决条件。
使用 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:我在关注这个 link - https://git-scm.com/book/en/v2/Git-Tools-Submodules
Should I create a repo for my-app submodule separately in github to be able to add it as a submodule in another repo (my-repo)
是的。
https://github.com/******/my-repo/my-app
不是要克隆的 Git 存储库的 URL。
它是现有存储库的子文件夹的 URL(即:https://github.com/*******/my-repo.git
)。
在自己的存储库中拥有 myapp
是能够将其作为子模块添加到另一个存储库的先决条件。