What is the difference between them both? I'm learning in my tutorial that they give out the global configuration settings, but I'm not really sure what the difference between them is, and when I should use either.
git config --list
will list all configurations currently visible (in the current directory)
It will list all the configurations, system wide at the top, followed by the global configuration (most often found under ~/.gitconfig
), followed by the local configurations (if inside a git repository).
cat .gitconfig
will most likely only work in your home directory (~/
)
Additionally the format of the two will differ.
See the documentation of git config for more details.
I don't see a reason why not to use git config --list
always.
cat .gitconfig
shows you the content of the file .gitconfig. If this is the one that is used by git (this is configurable), then it is identical to the according level of settings.
In Git you have three levels of settings files, in repository, global for your user and global for the whole computer with all its users. git config --list
will list all of them that are in effect in the place where you are.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With