Introduction
Welcome to the world of Version Control!
Imagine you are writing a very important book. Every time you finish a chapter or make a major change, you want to save a snapshot of your work. If you make a mistake later, you can easily go back to that snapshot.
Git is the tool that does this for code. It is a distributed version control system, which means every repository contains its own history instead of depending entirely on a central server.
That distributed design is one of Git's defining ideas. Even when you later use services such as GitHub or GitLab, the repository on your machine still has its own local history and can make commits independently.
Before you can start saving snapshots, which Git calls commits, you need to introduce yourself to Git. Every commit records an author identity so teams can see who made each change.
In this lab, you will:
- Verify that Git is ready to use.
- Set up your digital identity (Name and Email).
- Confirm your settings.
Check Git Installation
First, we need to make sure the "Time Machine" software is actually installed on your computer.
Most Linux systems come with Git pre-installed. You can check this by asking Git for its version number.
This first check matters because Git is a command-line tool you will use constantly. Knowing it is installed and available removes one whole class of later troubleshooting problems.
Run the following command:
git --version
You should see output similar to this:
git version 2.34.1
If you see a version number, you are good to go!
Configure Your Name
Now you need to introduce yourself.
When you save work in Git, it attaches a "badge" to that work. The first part of that badge is your Name.
We use the git config command to tell Git who you are. We use the --global flag so that this setting applies to every project on this computer (so you don't have to introduce yourself every time you start a new project).
That --global scope is important. Git configuration can exist at several levels, but global settings are a convenient default identity for all repositories owned by this user account.
Run this command (you can use your own name if you like):
git config --global user.name "LabEx User"
If the command is successful, it will be silent. Imagine Git nodding and writing your name in its notebook.
Configure Your Email
The second part of your "badge" is your Email Address.
This is crucial because services like GitHub use your email to link your code to your online profile.
More fundamentally, Git stores author identity inside commit metadata. A commit is not just file content; it also records who created that snapshot and when.
Run the following command to set your email:
git config --global user.email "labex@example.com"
Again, Git will silently accept this information.
Verify Configuration
Trust, but verify. Let's make sure Git recorded your details correctly.
You can ask Git to list all the settings it knows about.
Run this command:
git config --list
You should see a list of settings. Look for the ones we just added:
user.name=LabEx User
user.email=labex@example.com
If you see these lines, your Identity Card is ready!
Being able to inspect configuration is a useful habit. Git often behaves differently because of config values, so git config --list is one of the first places to look when something feels surprising.
Summary
Congratulations! You have successfully set up your Git environment.
In this lab, you learned:
- Checking Version:
git --versionconfirms Git is installed. - Setting Name:
git config --global user.name "..."sets your display name. - Setting Email:
git config --global user.email "..."sets your contact info. - Verifying:
git config --listshows your current settings.
Your "Time Machine" is now configured and knows who is operating it. You are ready to start your first project!



