在阅读了Git - git-submodule 文档后,我决定将以前项目中的两个文件导入到新项目的根目录中,因为我不想手动同步这两个文件。但是,当我执行以下命令时出现错误:
$ git submodule add -b master -f --name latexci -- \
https://github.com/donizyo/LaTeX-Travis.git .
fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths
usage: git submodule--helper clone [--prefix=<path>] [--quiet] [--reference <repository>] [--name <name>] [--depth <depth>] --url <url> --path <path>
--prefix <path> alternative anchor for relative paths
--path <path> where the new submodule will be cloned to
--name <string> name of the new submodule
--url <string> url where to clone the submodule from
--reference <repo> reference repository
--dissociate use --reference only while cloning
--depth <string> depth for shallow clones
-q, --quiet Suppress output for cloning a submodule
--progress force cloning progress
Run Code Online (Sandbox Code Playgroud)
我正在使用Git Bash 2.19.1.windows.1来执行 git 命令。
路径 ( .) 应该是一个不存在的文件夹,例如Latex-Travis.
相反,这里 ' .' 被解释为空路径(因为它引用您的父存储库),如ruby-git/ruby-git问题 345所示:
自 Git 2.1.6 以来,这确实已被弃用:
空字符串作为路径规范元素,表示“一切”,即“git add”“”,现在是非法的。我们首先在 2.11(2016 年 11 月)中弃用并警告包含此类元素的路径规范。
我不知道直接在父存储库文件夹中添加的子模块:我总是习惯添加为父存储库子文件夹。