You usually can find the gitconfig file if you stop panicking and look where Git actually looks. Git reads three scopes project global and system. Each scope lives in a predictable place most of the time unless your environment is trying to be mysterious.
Short list for the impatient and the tired
.git/config
inside the repo~/.gitconfig
or when you follow the XDG standard ~/.config/git/config
/etc/gitconfig
on Linux and C:\ProgramData\Git\config
on WindowsStop guessing and run the command that tells the truth
git config --list --show-origin
This prints every setting and the file it came from. If a setting shows as coming from the command line that means an environment override or a CLI flag is in play. If you see nothing for a given key it probably was never written to any file.
git config --global --edit
to open or create your user level filegit config --system --list
to inspect system level values which may need administrator rightsgit config --global user.name 'Your Name'
and git config --global user.email 'email@example.com'
to create the global file and stop Git from nagging~/.config/git/config
instead of ~/.gitconfig
On Windows check your user profile for \.gitconfig
and check C:\ProgramData\Git\config
for system level settings. If you installed Git with default options the program data path is where the system file shows up.
If you like managing dotfiles with symbolic links remember Git honors the XDG standard when XDG_CONFIG_HOME
is set. That explains a lot of surprises when your dotfile repo is not where Git expects. A quick environment check will save you from rifling through hidden folders like a sleep deprived raccoon.
Run git config --list --show-origin
first and stop wandering blindly. If you need to create a global file set user.name and user.email with git config --global
and Git will make the file for you. If you still cannot find what you need check which user you are running as and whether XDG_CONFIG_HOME is set. Now go fix your config and pretend this was all part of your plan.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.