Git provides different configurations and user.name
is one of them. We can also call this user name
where we can set the current user name which can be used for the git-related operations like commits, changes, etc. In this tutorial, we examine how to set the user name for the git.
“git config user.name” Command
The user name for the current repository can be set by using the git config user.name
command providing the user’s name. Use double or single quotes in order to prevent errors in the name.
$ git config user.name "İsmail Baydan"
“git config –global user.name” Command
We can use the --global
option in order to set the user name globally where every repository the user access.
$ git config --global user.name "İsmail Baydan"
~/.gitconfig Configuration File
The user global user name configuration is stored inside the user’s home directory with the file named .gitconfig
. The .gitconfig file is a simple text file that stores the user name as simple text. We can access this file directly and change or set the username like below. The name
is located under the [user]
section.
[user]
name=İsmail Baydan