Log in & out of Git via Terminal (Mac)

Sean Norton
2 min readApr 20, 2018

--

A quick guide.

Log in, adding Git username and email

Set your Git username

This will set your Git username for all repositories on your computer (global)

  1. Open Terminal
  2. Set your Git user name
$ git config --global user.name "your name"

3. Confirm that you have set a Git username correctly

$ git config --global user.name

Set your Git email

This will set your Git email for all repositories on your computer (global)

  1. Open Terminal
  2. Set an email address in Git. Use the email you use to sign into Github
$ git config --global user.email "email@email.com"

3. Confirm that you have set a Git email correctly

$ git config --global user.email

Signing in for a single repository

  1. Open Terminal
  2. Change the current working directory to the local repository where you want to configure the email address/username that you associate with your Git commits.
  3. Use the code above but remove:
--global 

Removing/Changing Git username or email

Removing Global

  1. Open Terminal
  2. Remove global user.name and user.email
$ git config --global --unset-all user.name
$ git config --global --unset-all user.email

Changing Global

  1. Open Terminal
  2. Change global user.name and user.email
$ git config --global --replace-all user.name "Your New Name"

$ git config --global --replace-all user.email "Your new email"

--

--

Sean Norton

Software Developer, focusing on Javascript and other front end technologies.