Log in & out of Git via Terminal (Mac)
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)
- Open Terminal
- 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)
- Open Terminal
- 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
- Open Terminal
- 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.
- Use the code above but remove:
--global
Removing/Changing Git username or email
Removing Global
- Open Terminal
- Remove global user.name and user.email
$ git config --global --unset-all user.name
$ git config --global --unset-all user.email
Changing Global
- Open Terminal
- 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"