Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

As it is told in git-config manual, I have three files to specify git repo configuration: $GIT_DIR/config, ~/.gitconfig and $(prefix)/etc/gitconfig. Is it possible to make git read another config file (for example .gitconfig in root of the repo) after reading $GIT_DIR/config?

I want it as I created git command aliases in .git/config and I would prefer to store them in repo, so I can restore them when cloning and for example.

share|improve this question

1 Answer 1

GIT_CONFIG environment variable and -f command line option are the only ways how to specify custom config file and this will read that single file only.

My informed guess on the answer is You can store the config file in git, but users will have to merge changes to .git/config manually.

Also note that using file under git's control may lead to issues where different branches have different config files with different remotes and branches - seems like a way to ask for troubles.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.