Sunday, June 13, 2021

Git: How to set Git User Name and User email Globally & repository specific

Usually when we install Git, we typically configure your global username and email address after installing Git. However, you can do so now if you missed that step or want to make changes. After you set your global configuration, repository-specific configuration is optional.

Git configuration works the same across Windows, macOS, and Linux.

To set your global username/email configuration:

Open the command line.

-- set user name
$ git config --global user.name "First Name Last Name"
-- set user email
$ git config --global user.email "useremail@gmail.com"

To set repository-specific username/email configuration:

From the command line, change into the repository directory.

--Set your username
$ git config user.name "FIRST_NAME LAST_NAME"

--Set your email address
$ git config user.email "useremail@gmail.com"

--Verify your configuration by displaying your configuration file
$ cat .git/config

Hope this helps!

No comments:

Post a Comment