git 使用 git 子模块更新 --init 时出错

git error when using git submodule update --init

在 zsh 上使用以下命令时出现错误:

git submodule update --init

我得到的错误是:

fatal: No url found for submodule path 'bundle/YCM' in .gitmodules

问题是,当我转到 .gitmodules 文件时,我定义了以下行:

[submodule "/home/username/.vim/bundle/YCM"]
    path = /home/username/.vim/bundle/YCM
    url = https://github.com/Valloric/YouCompleteMe

其中 username 是我的实际用户。 我通过

安装了 YCM 插件
git submodule add https://github.com/Valloric/YouCompleteMe ~/.vim/bundle/YCM

路径应该是相对于存储库根目录的,例如

[submodule "bundle/YCM"]
    path = bundle/YCM
    url = https://github.com/Valloric/YouCompleteMe

来自gitmodules(5)

Defines the path, relative to the top-level directory of the Git working tree, where the submodule is expected to be checked out. The path name must not end with a /. All submodule paths must be unique within the .gitmodules file.