I just started learning about Linux and Git. Im using Linux Mint. I have Git and emacs installed via apt-get.
Im using the following tutorial https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
it says that there are configuration files in three different places:
/etc/gitconfig
file~/.gitconfig
or ~/.config/git/config
fileI have just started with Git so assume that option 3) is not applicable
I checked both 1) and 2) - i just cannot locate the files anywhere
I googled this with no luck and did sudo find . -name
in the root directory
Have no clue what is happening as when i run this
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
(i used my name surname above obviously)
it doesn't give me an error or anything - so where does it write this config data then?? where are these files?
As confirmed by the OP, any git config --global
command will create/update ~/.gitconfig
.
But as it is an hidden file by default, you would need a ls -alrt
to see it.
git config --global -l
will list its content.
More generally, git config --list --show-origin
shows all config files (and each line of the config data).
With Git 2.26 (Q1 2020), you can add a --show-scope
option
git config --list --show-origin --show-scope
That will also print the scope ("local
", "global
", etc) of all displayed config values.
With Git 2.37 (Q3 2022), confirm that git config --show-scope
does show worktree, in addition of local, global, system and command configs.
See commit db7961e (07 Jun 2022) by Glen Choo (chooglen
).
(Merged by Junio C Hamano -- gitster
-- in commit 21bb385, 13 Jun 2022)
config
: document and test the 'worktree
' scopeSigned-off-by: Glen Choo
Test that "
git config --show-scope
"(man) shows the worktree scope, and add it to the list of scopes inDocumentation/git-config.txt
."
git config --help
"(man) does not need to be updated because it already mentionsworktree
".
git config
now includes in its man page:
(worktree, local, global, system, command).