git/list[1] front-page[2] threads[3] people[4] search[5] about
 

What is XDG_CONFIG_HOME for exactly?

From
RDRobert Dailey <rcdailey.lists@gmail.com>
Date
Mar 15, 2015, 23:37 UTC
Message-ID
<CAHd499CmxwGJeW6gMARhc+cT+r3TK98m+LyyS+eCFXz8qKHrFw@mail.gmail.com>
My understanding is that git reads the priority of configuration as follows:
1. <local_repo>/.git/config
2. $HOME/.gitconfig
3. $XDG_CONFIG_HOME/git/config
4. system level git config (not sure exactly where this is; not
relevant to me on Windows)

I have a .gitconfig in Dropbox that I symlink to my home directory on different platforms. Specifically, I share this gitconfig across Cygwin/msys on Windows and Ubuntu.

If I can use XDG_CONFIG_HOME to leverage platform-specific settings, I'd be able to keep platform-agnostic settings in my $HOME/.gitconfig and put platform-specific settings in $XDG_CONFIG_HOME/git/config and simply give XDG_CONFIG_HOME a different name on different platforms.

Is this what it was designed for? If not, what would be the best approach for this? I was thinking of contributing a patch that would let you specify the name of your git config in the home directory, but I'm not sure if that is necessary. Something like this:

$HOME/$GIT_CONFIG_FILENAME, where GIT_CONFIG_FILENAME defaults to ".gitconfig" if it is not set or empty.

Next: Robert Dailey
Message 1 of 4 in “What is XDG_CONFIG_HOME for exactly?”
  1. Robert DaileyMar 15, 2015
  2. Robert DaileyMar 15, 2015
  3. Robert DaileyMar 15, 2015
  4. Matthieu MoyMar 16, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.