Setting username and email in git
You can set username and email in your system for a specific repository or globally. When you apply globally, the settings are applicable for all the repositories in your system. Let us see both ways.
A local git setup is in a directory repoone. This directory has a .git sub-directory which means this point onwards is the git setup. You can issue the command “git config” as shown to set username and email.
~/repoone$ ls
dirone filefive filefour filesix filethree filetwo README.md
~/repoone$ git config user.name "Code Version Master"
~/repoone$ git config user.email "codeversionmaster@gmail.com"
Use “git config –list” to check the settings in the git setup within this directory repoone.
~/repoone$ git config --list
user.email=codeversionmaster@gmail.com
user.name=Code Version Master
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@github.com:codeversionmaster/repoone.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.main.remote=origin
branch.main.merge=refs/heads/main
user.name=Code Version Master
user.email=codeversionmaster@gmail.com
Note that the above command would set username and email only in repoone directory. In case of multiple git setups in your account, use “git config –global” to set a common username and email for all git setups.
~/repoone$ git config --global user.name "Code Version Master"
~/repoone$ git config --global user.email "codeversionmaster@gmail.com"