How to install Git on Linux (Ubuntu)
New Courses Coming Soon
Join the waiting lists
In this post I’m going to detail how to get Git up and running on Linux, in particular on Ubuntu.
First, open your terminal. We’ll use the command line for this installation.
Step 1: Update your package list with the following command:
sudo apt update
You may need to enter your password. This is a standard security measure.
Step 2: Install Git using this command:
sudo apt install git
Ubuntu will now install Git for you.
To verify the installation, type:
git --version
This should display the installed Git version.
Next, set up your Git identity:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Replace “Your Name” and “[email protected]” with your actual details.
If you use VS Code, you can set it as your default Git editor:
git config --global core.editor "code --wait"
This will open VS Code for commit messages and other Git operations that require text input.
With Git installed, you can start version controlling your projects. Navigate to your project folder and use git init
to create a new repository.
While Git may seem complex initially, it becomes an invaluable tool with practice. It’s widely used in software development for its powerful version control capabilities.
Check out my Git Cheat Sheet on freeCodeCamp, and download the PDF version from https://flaviocopes.com/access
Here is how can I help you:
- COURSES where I teach everything I know
- CODING BOOTCAMP cohort course - next edition in 2025
- THE VALLEY OF CODE your web development manual
- BOOKS 17 coding ebooks you can download for free on JS Python C PHP and lots more
- Interesting links collection
- Follow me on X