🧰 Setting up your username and email in Git at your first dev job
Stefi Rosca
Posted on November 30, 2021
One of the things I had to do when getting my first job was configuring Git. Unless you setup your name and email address Git will take it from the environment. This is important because every Git commit uses this information and if it's not setup correctly it will not be linked to your Github account. Hence if you have a profile picture it won't show.
There are 2 ways to do it:
1. Globally
Open the command line and run the following commands with your name and email.
To setup your username:
$ git config --global user.name "Stefi Rosca"
To setup your email:
$ git config --global user.email "stefi.rosca@me.com"
In this case you only have to do it once and Git will always use this information for anything you do on that system.
2. Repository-specific
From the command line, change into a repository directory where you want to make this change and then run the commands as below.
To setup your username:
git config user.name "Stefi Rosca"
To setup your email address:
git config user.email "stefi.rosca@me.com"
To test that you set it up correctly you can run in your in a specific Git terminal git config user.email
.
Make sure you change the name and email in the example above to yours.
For more information check out chapter on Getting Started from the Pro Git book
Posted on November 30, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.