Git子模块被忽略

问题描述 投票:0回答:1

当我尝试通过添加子模块

git submodule add git@domian:repo.git contact

我收到以下消息:

您的.gitignore文件之一忽略以下路径:

联系

如果你真的想添加它,请使用-f。

这是我的.gitignore

# Ignore everything
*

# But not these files:
!*.py
!*.md
!*.gitignore
!.gitmodules
!contact/

它通过使用建议的-f选项解决,但我很好奇为什么在!contact/.gitignore条目不能缓解这个问题。

git-submodules gitignore
1个回答
0
投票

我没有在你的特定情况下遇到这个错误(我有git版本2.21.0.windows.1)。

尝试在父存储库外添加子模块时,我确实遇到了这个错误(显然不支持):

$ git submodule add https://github.com/user/repo ../repo
The following path is ignored by one of your .gitignore files:
../repo
Use -f if you really want to add it.

最好的猜测是它是一个错误...所以将!contact/添加到你的.gitignore并没有解决它,因为它实际上不是导致问题的.gitignore

你有什么git版本?您可以下载source code for your particular version,搜索错误消息(例如v2.21中的here it is),并跟踪代码以找出实际出错的地方。

© www.soinside.com 2019 - 2024. All rights reserved.