git 尝试初始化子模块时出现“致命:未找到子模块路径的 url”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41102308/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:29:37  来源:igfitidea点击:

'fatal: No url found for submodule path' error when trying to init submodule

gitgit-submodules

提问by Bhargav

The name of the repository that I am using as a submodule in my current repository is droid-media-lib, but the name of the directory into which this submodule is put into is libraryso my .gitmodules looks like this

我在当前存储库中用作子模块的存储库droid-media-lib的名称是,但是此子模块放入的目录的名称是library这样我的 .gitmodules 看起来像这样

[submodule "droid-media-lib"]
        path = library/
        url = https://github.com/talview/droid-media-lib.git

Now when I am trying to clone this project on a different computer, and do

现在,当我尝试在另一台计算机上克隆此项目时,请执行以下操作

git submodule update --init

I get this error

我收到这个错误

fatal: No url found for submodule path 'library' in .gitmodules

What I've tried so far:

到目前为止我尝试过的:

  • I've tried changing submodule "droid-media-lib" to submodule "library", still getting same error.

  • I've tried renaming the library directory name to droid-media-lib and setting the same value in path as path = droid-media-lib/", but surprisingly the error message stays the same with "library" in it, I don't understand where its reading the "library" string from?

  • 我尝试将子模块“droid-media-lib”更改为子模块“library”,但仍然出现相同的错误。

  • 我已经尝试将库目录名称重命名为 droid-media-lib 并在路径中设置与 相同的值path = droid-media-lib/",但令人惊讶的是错误消息与其中的“库”保持相同,我不明白它在哪里读取“库” ” 字符串从?

采纳答案by DUman

Submodule paths may not end in a slash.

子模块路径不能以斜线结尾。

path=library/

is an invalid configuration, instead you can have:

是无效的配置,您可以改为:

path=library