Git – Distributed Version Control System


How to set the username and email id for git repository

For Globally

git config –global user.name “username”
git config –global user.email “email id”

examples:
$git config –global user.name “yourname”
$git config –global user.email “yourname@somesite.com”

After this when you do any commit then it will add your name and mail address to that commit. Now to see the changes cat the .gitconfig file in your home dir

$cat ~/.gitconfig

[user]
name = yourname
email = yourname@somesite.com

For individual repository

if you want to use diffrent name and email id for a particular git then use as below after going in to that git repository.

$git config user.name “yourname”
$git config user.email “yourname@somesite.com”

To check the changes view the file .git/config you will find the below entries in that file

$cat .git/config

[user]
name = yourname
email = yourname@somesite.com

Change the default git comment editor

To change the default editor for you git use the flowing in my case I am using emacs as my favorite editor

$ git config –global core.editor emacs

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s