Configuring user name, email and default editor in git for first time use

The first thing you should do when you install Git is to set your user name and email address. This is important because every Git commit uses this information.

echo -n "Enter your Name : "
read GIT_USERNAME

echo -n "Enter your Email : "
read GIT_USEREMAIL

git config user.name "$GIT_USERNAME"
git config user.email "$GIT_USEREMAIL"

Now, 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 user.name "$GIT_USERNAME"
git config --global user.email "$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.

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

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

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

You can use our script from github at https://github.com/lynxbee/working-with-git/blob/master/git-setup-configs.bash

READ  How to clone a large git repository

Leave a Reply

Your email address will not be published. Required fields are marked *