Course contentsShow
← Git & GitHub
Lesson 7 of 961. Foundations of Version ControlFree lesson

Defining Your Global User Identity

You will configure your name and email address globally so that all future commits are correctly linked to your digital identity.

In this lesson, you will learn how to configure your Git identity so that your contributions are properly attributed to you.

Why Do You Need an Identity?

Imagine you are working in a professional office. Every time you submit a report, you sign your name at the bottom so your manager knows who did the work. Git functions the same way. Every single "snapshot" (or commit) you take of your project needs to be linked to a person.

By setting your global user identity, you are telling Git exactly who you are. This ensures that whenever you save progress on any project, your name and email address are permanently attached to that work. Without this, your commits would remain anonymous, making it impossible for collaborators (or your future self) to know who made specific changes.

Setting Your Global Identity

You only need to do this once. Because we are setting this globally, Git will remember these details for every project you create on your computer from here on out.

Open your terminal or command prompt and run the following two commands, replacing the text in the quotes with your actual information:

git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"

How to Verify

After running those commands, you can double-check that Git has saved your information correctly by typing:

git config --global --list

This will print your name and email back to the screen. If you ever change your email address, you can simply run those same commands again to update your details.

Why This Matters

When you eventually share your work or collaborate with others, these details act as your digital signature. If you were to skip this step, Git would attempt to guess your identity based on your computer's system settings, which often results in messy or incorrect labels like "user@localhost." By taking these few seconds to configure your identity, you ensure that your contributions are always clean, professional, and uniquely yours.

Key Takeaway: Setting your global user identity creates a digital signature that links your work to your name, ensuring all your future commits are accurately attributed to you.