Installing and Setting Up Git on Ubuntu (Beginner’s Guide)

Source: Dev.to | Jan 14, 2026 (UTC)

When starting your journey in software development, one of the first tools you’ll encounter is Git. Git is a distributed version control system that helps developers track changes in their code, collaborate with others, and manage projects efficiently.

Most developers store their projects in repositories (commonly called repos) on platforms such as GitHub. Git allows you to interact with these repositories directly from your local machine — pushing changes, pulling updates, and managing versions of your code.

In this guide, we’ll walk through how to install Git on Ubuntu and perform the basic configuration needed to get started.

Prerequisites

Before you begin, make sure you have:

  • A PC running Ubuntu (or another Debian-based Linux distribution)
  • A GitHub account –> If you don’t have one, sign up at: https://github.com/

Step 1: Update Your System Packages

Open your terminal using Ctrl + Alt + T, then update your package list:

sudo apt update

Enter fullscreen mode

Exit fullscreen mode

Step 2: Install Git

Install Git by running:

sudo apt install git

Enter fullscreen mode

Exit fullscreen mode

Press Y when prompted to confirm the installation.

Step 3: Verify the Installation

Once the installation is complete, confirm that Git was installed successfully:

git --version

Enter fullscreen mode

Exit fullscreen mode

If Git is installed correctly, you’ll see output similar to:

git version 2.x.x

Enter fullscreen mode

Exit fullscreen mode

If you see the version number, you’re good to proceed.

Step 4: Configure Your Git Username

Git uses a username to identify who made each commit. This should match the username you use on GitHub.

Run the command below and replace your-github-username with your actual GitHub username:

git config --global user.name "your-github-username"

Enter fullscreen mode

Exit fullscreen mode

Step 5: Configure Your Git Email

Next, set the email address associated with your GitHub account. This email will be attached to your commits.

Replace [email protected] with the email you used when signing up on GitHub:

git config --global user.email "[email protected]"

Enter fullscreen mode

Exit fullscreen mode

Step 6: Confirm Your Git Configuration

To verify that your username and email were set correctly, run:

git config --list

Enter fullscreen mode

Exit fullscreen mode

You should see output that includes both your user.name and user.email.

user.email=[email protected] user.name=your-github-username

Enter fullscreen mode

Exit fullscreen mode

What’s Next?

At this point, Git is successfully installed and configured on your machine.
However, to fully interact with GitHub (especially pushing and pulling code), it’s recommended to set up SSH authentication.

In the next article, we’ll cover:

Installing and configuring Git is an essential first step for any developer. With Git set up on your Ubuntu system, you’re now ready to start managing projects, collaborating with others, and contributing to open-source software.

Happy coding!!!

For further actions, you may consider blocking this person and/or reporting abuse

Залишити відповідь

Ваша e-mail адреса не оприлюднюватиметься. Обов’язкові поля позначені *

Читайте також