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

~/repoone$ git config "Code Version Master"

~/repoone$ git config ""

Use “git config –list” to check the settings in the git setup within this directory repoone.

~/repoone$ git config --list Version Master
branch.main.merge=refs/heads/main Version Master

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 "Code Version Master"

~/repoone$ git config --global ""