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
user.email=anto.aravinth.cse@gmail.com
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.

Answers


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

(if done with git1.7.1 or less and run outside a git repo, as illustrated by this git-dropbox ticket. The solution was to ignore the error message:

 DROPBOX_REPO=`git config --local dropbox.repo 2>/dev/null`

)


Need Your Help

Why I am not able to get recently added objects (yet to be saved in database) from repository

c# entity-framework asp.net-mvc-4 repository unit-of-work

I am developing an asp.net mvc4 application in which repository and unit of work pattern was implemented. I want some solution to get the newly added data from repository means i want to able to

Direction of normals

normals

Currently, I have a program that will revolve a simple 2d polygon around the x-axis to create a 3D shape. The problem is that in order to make sure that the normals for the surfaces are aligned

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.