Git ignore embedded repositories

Viewed 324

I have an all-encompassing repository to track my notes. But next to the notes, there are often git repositories that I don't want to track.

This is how my gitignore is setup:

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

And it works really well, so much so that I can simply do git add ., except for the aforementioned case of nested repositories. Currently, I have to manually add them to the gitignore - if I don't, this happens:

❯ 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                                                                                                                                                                                           

Which is what I would like to avoid. Is there some way to configure git or my gitignore to always simply ignore embedded repositories?

1 Answers

Try:

git config submodule..active false

Related