Search code examples
gitincludegit-config

How to include multiple files in a git repo config?


I want to include multiple config files in a Git repo config. However, when I run multiple commands like

git config include.path /path/to/config/file

only the last path is saved in the config. Does Git support multiple includes? If yes, how to include multiple files from the CLI?


Solution

  • Use the --add option

    git config --add include.path config1.txt
    git config --add include.path config2.txt
    
    $ git config --get-all include.path
    config1.txt
    config2.txt