Skip to content

Git configuration

Having different configuration per directory

It's possible to have different configurations per directory by using includeif sections.

My configuration is like this:

[includeIf "gitdir:~/Private/"]
    path = ./user_home

[includeIf "gitdir:~/Work/"]
    path = ./user_work

[includeIf "gitdir/i:**/GitHub/"]
    path = ./user_github

Which means that all repos inside ~/Private/ will include the file user_home with my own settings (name, mail, etc). For the work repositories (inside ~/Work), then the configuration to use will be user_work.

This is convenient as it allows you to have different identities (and other settings) depending on the repository you're working on, without having to change anything by hand.

Note

leading ~ or ** seams required to work

store passphrase on linux

See: this page