Configuring Git environment

Configuring Git environment

git needs some basic configuration to commit repositories. because there are so many other users, where they will commit changes or access repo .to do these all users should configure git profile globally or locally. the uses of the git profile will be our further topic.

for configuring our git profile for every repository we should use --global tag

for configuring our git profile for the only individual repository we should not use --global tag.

Setting username

git config --global user.name "codeskulls"

Setting user email

git config --global user.email "codeskulls@outlook.com"

Color highlighting

to change the colors in the git console

git config --global color.ui true
git config --global color.status auto
git config --global color.branch auto

Setting default editor

git config --global core.editor nano

Setting the default merge tool

git config --global merge.tool nano

Listing git settings

git config --list

these all configurations are stored in a file called .gitconfig, we can edit that file if we want to change our configuration again or we can run the above commands again .but these are supported for the only global profile.

To edit or view configuration

nano .gitconfig
cat .giconfig

but to configure our git profile for the separate repository we should not use --global tag and .first we should initiate a git directory to use the above commands without -- global.

Initiate a git directory

mkdir abcd
cd abcd
git init

Example for one config without --global

git config user.email "codeskulls@fzyufmail.com"

git configuration for any local or individual directory is stored in a different file called .git/config file. we can edit this file anytime

cat .git/config

Edit config files using commands

user can edit the git config files locally if the user runs git locally, user can also edit global config file too

git config --global -e
git config --system -e
git config --local -e

to modify git config files, in system-wide user can use 2nd command from above

Last updated on by vishal devxo