How to Configure Username, E-mail For First Time Git Setup ?

The first thing you should do when you install Git is, configure it to set your user name and email address. This is important because every Git commit uses this information to track who is the Author of this source code, what is his E-mail Id and date,time of when this code has been modified.

If you want to set the username and Email Id only for one git source and not for all the git’s available on your system, we can do the same by entering into the directory where git has been created and typing below commands,

 $ cd workspace
$ cd git_directory
$ git config "YOUR_USERNAME"
$ git config "YOUR_EMAIL_ID"
$ git config core.editor YOUR_PREFERRED_EDITOR

Above commands, sets the user name, email and editor for the git you are inside the directory.

Now, If you need to do this only once and available for all gits on the system, you can pass the –global option with above git config commands, like below,

$ git config --global "$GIT_USERNAME"
$ git config --global "$GIT_USEREMAIL"

You can configure the default text editor that will be used when Git needs you to type in a message. If not configured, Git uses your system’s default editor.

If you want to check your settings, you can use the git config –list command to list all the settings

git config --list

You can do all of this using our below script,

#run it as, bash git-setup-configs.bash
#GIT_USERNAME="Linuxbee Developer"
#The first thing you should do when you install Git is to set your user name and email address.

#if you get any error related to updating user name etc if it was
# already updated in your machine, use FORCE_UPDATE="--replace-all"


echo -n "Enter your Name : "

echo -n "Enter your Email : "

# using --replace-all, to prevent any error if already configured,
# so this will override previous

echo -n "do you want to set this user credentials to all gits on this computer ? (yes / no) "
read userinput
if  [ $userinput == "yes" ]; then
	echo "setting userdetails as global"
	git config --global $FORCE_UPDATE "$GIT_USERNAME"
	git config --global $FORCE_UPDATE "$GIT_USEREMAIL"

echo -n "Which editor you want to use? (vim / emacs) "
read usereditor
git config $FORCE_UPDATE --global core.editor $usereditor

echo "Your configurations has been set for..."
git config --list

You can use our script from GitHub at

How to merge in GIT x
How to merge in GIT

Leave a Comment

Sign up to our newsletter!

ADB Commands Android Android Applications Android Build system Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development, Debugging and Performance Tools Development and Build Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia NDK / Middleware / HAL Operating System Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web Design and Development Website Hosting Wordpress Yocto Embedded Linux