🧰 Setting up your username and email in Git at your first dev job

stefirosca

Stefi Rosca

Posted on November 30, 2021

🧰 Setting up your username and email in Git at your first dev job

Before and after example with image and name from profile

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"
Enter fullscreen mode Exit fullscreen mode

To setup your email:

$ git config --global user.email "stefi.rosca@me.com"
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode

To setup your email address:

git config user.email "stefi.rosca@me.com"
Enter fullscreen mode Exit fullscreen mode

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

💖 💪 🙅 🚩
stefirosca
Stefi Rosca

Posted on November 30, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related