Last Updated: September 27, 2021
· ajduke

Sourcing custom located .gitconfig file

Git is most popular Version control system used widely in both open source and enterprise worlds.

It is mostly popular because of feature and configuration it provides.

Speaking of configuration, it allows you to do configuration in .gitconfig file, mostly placed at home directory of machine.

Possible locations for this are as follows -

  • System wide at inside /etc , for .e.g /etc/gitconfig
  • Inside user home directory, for .e.g ~/.gitconfig
  • Inside any git project .git directory, for.e.g ./.git/config

Note, different file names for each locations.

Beauty of Git is, it allows you to place you anywhere other than above mentioned directories.

But you will need to tell Git where you put the your gitconfig file.
For this, You will need to include the following lines in System wide or user home directory gitconfig file

    path= /path/to/file/.gitconfig

This is pretty good trick when you are maintaining the dotfiles for all tools configurations like gitconfig

Note To use this feature, please make sure you have Git Version 1.7.10 or above

1 Response
Add your response

Thanks for the tip! We need to look into using this in regards to our automatic deployment configurations.

over 1 year ago ·