git config --global to set things up, to which file will it write?
git config --global core.editor "blah"
I can't find it at these places:
I have not set an ENV?
My Git version: 188.8.131.52.1367.gcd48 –
on Windows 7
From the docs:
For writing options: write to global
~/.gitconfigfile rather than the repository
Since you're using Git for Windows, it may not be clear what location this corresponds to. But if you look at etc/profile (in
C:\Program Files\Git), you'll see:
(on Windows 7)
That means the file is in
C:\Users\MyLogin\.gitconfig for Git in Windows 7.
Note: with git 2.8 (March 2016), you can simply use:
git config --list --show-origin
You will see which config is set where.
See "Where do the settings in my Git configuration come from?"
I was also looking for the global
.gitconfig on my Windows machine and found this neat trick using git.
git config --global -e and then, if you are lucky, you will get a text editor loaded with your global
.gitconfig file. Simply lookup the folder from there (or try a save as...), et voilà! :-)
On *nixes, it's in
~/.gitconfig. Is there a corresponding file in your home?
On Windows you can type in git bash
The paths for msysgit are:
Windows XP -
C:\Documents and Settings\<user_name>\.gitconfig
The global location is derived, on Windows MsysGit, using the HOMEDRIVE and HOMEPATH environment variables, unless you have defined a HOME environment variable. The is detailed in the 'profile' script.
In my corporate environment the HOMEDRIVE is H:, which is then mapped to a network URL \\share\$. The whole lot is then mapped to be "My Documents", which isn't where others would expect. There may have been some further problems with the drive to URL remapping. I don't even get to adjust the HOMEDRIVE or HOMEPATH variables anyway.
In my case I have defined a personal HOME environment variable and pointed it to D:\git\GitHOME and copied all those GIT files (which are without and extension) to the GitHOME directory for safe keeping.
The windows environment variables can be set via the Advanced tab in the My Computer properties dialog.
If you are using TortoiseGit on a windows pc you can use:
Settings / Git / Config / Edit global .gitconfig
to open the global .gitignore file.
But if you use your windows (7) pc in a domain your profile dir is may be a network share (mounted as a drive). In this case TortoiseGit (at least:184.108.40.206) is pointing you to the wrong dir (on c:...). In this case wait for the bug https://tortoisegit.org/issue/922 to be resolved or use %HOMEDRIVE%%HOMEPATH% to open the dir that contains the .gitignore file.
I am using SmartGit with msysgit on Windows 8.1 and noticed that there are three different locations for the
C:\Users\name\.gitconfig C:\Program Files (x86)\Git\etc\gitconfig C:\Program Files (x86)\SmartGitHg\git\etc\gitconfig
But the one that is used is the one from "
It might be useful to note (for *nix platforms): some types of global git configuration/information are stored in
/usr/share/git-core/, such as git autocompletion scripts and the following (default) hooks:
Each of these can contain their own set of commands to execute, at the time described by their respective filenames.
I had also a problem with my global
This is for the case someone also has this strange
fatal: unknown error occured while reading the configuration files
Now I fixed it. The problem was a second
.gitconfig in this folder:
I don't know where it came from... But now everything works like a charme again.
I am running Windows 7 and using git as setup by following the instructions on GitHub (a year or two back). A rather common use-case I would have thought. None of the answers above helped me, and after much frustration I eventually found my 'real' gitconfig file in the following directory;
Obviously substitute your user name and presumably the suffix after PortableGit_ is a unique GUID or similar.
Uninstall Msysgit and install Cygwin + Git. Then global '.gitconfig' will be here: C:\cygwin(64)\home\[userName]\.gitconfig .
Now you don't have to worry about an environment variable which may be used by other programs. For example, my environment variable pointed me to a mapped drive in my work windows domain environment. I dont want my global .gitconfig sitting on my "home" mapped drive. I also don't know what might happen to other applications that might rely on that windows environment variable. Operations division might need that environment variable set to the mapped drive for a reason.
Also you don't have to worry about Mysysgit overwriting your 'profile' configuration settings if you specify a specific path to global '.gitconfig', using this method.
In general, save yourself and use cygwin bash shell in windows and be happier
I had a similar issue; the problem was that the
.gitconfig file was located in
(on Windows 7)
In other words, the file was located in
C:\Users\MyLogin\.gitconfig\.gitconfig, instead of on
C:\Users\MyLogin\.gitconfig (which is where Git was looking for the files).