What is the use of two or more User.Name in Git.
I'm a novice in Git and I have started learning Git by using the free online book. I have few doubt to clear:
I have used this command to set up my Git:
$ git config --global user.name "Anto"
Later on I just used this command:
$ git config user.name "anto aravinth"
(that is without the --global option)
And now when I run with the following command:
$ git config --list
I'm getting the output as:
user.name=Anto firstname.lastname@example.org push.default=matching color.status=auto color.branch=auto core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true user.name=anto aravinth
In the above command I can see two user.name field with the values anto and anto aravinth respectively. So whats the point of two user.name here? To allow more than one user on the same system or what else? As I'm a novice it will be good if the answer is simple enough.
Thanks in advance.
As mentioned in git config man page:
- environment variables like GIT_AUTHOR_NAME and GIT_COMMITTER_NAME will override local config (config within a current repo)
- local config will override global config (config within $HOME/.gitconfig, which supposes you have define an environment variable HOME, knowing that it isn't defined by default on Windows)
- global config will override system config (config within the git installation directory itself)
Note that git config --list --local can have several error message:
fatal: unable to read config file '.git/config': No such file or directory
(if done outside of a git repo directory)
error: unknown option local
DROPBOX_REPO=`git config --local dropbox.repo 2>/dev/null`