Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

I wanted to check some of my settings in, so I use an include file. In the root of my repo I have a .myGitConfig file and in my .git\config file I have this:

    path = ..\\gitconfig

Your syntax may be different if you aren't using Windows. The only trick is that you have to have to add that include line to every .git\config file. That's the best I could come up with. Hope it helps.

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.