Git忽略嵌入式存储库

问题描述

我有一个全面的资料库来跟踪我的笔记。但是在笔记旁边,经常有我不想跟踪的git存储库。

这是设置我的gitignore的方式:

*.*
!*.kts
!*.org
!*.md
!*.txt
!*.sc

它非常好用,以至于我可以简单地做git add .,除了上述嵌套存储库的情况。目前,我必须手动将它们添加到gitignore-如果不这样做,则会发生这种情况:

❯ g add 1-projects
warning: adding embedded git repository: 1-projects/mixxx/mixxx-manual
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not kNow how to obtain it.
hint: If you meant to add a submodule,use:
hint: 
hint:   git submodule add <url> 1-projects/mixxx/mixxx-manual
hint: 
hint: If you added this path by mistake,you can remove it from the
hint: index with:
hint: 
hint:   git rm --cached 1-projects/mixxx/mixxx-manual
hint: 
hint: See "git help submodule" for more information.
warning: adding embedded git repository: 1-projects/mixxx/mixxx
warning: adding embedded git repository: 1-projects/mixxx/website                                                                                                                                                                                           

我想避免的是哪个。有什么方法可以配置git或我的gitignore,使其始终简单地忽略嵌入式存储库?

解决方法

尝试:

git config子模块..active false