Skip to content

How to install Git on Linux (Ubuntu)

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 "youremail@example.com"

Replace “Your Name” and “youremail@example.com” 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.

Want to actually learn Git? Want to stop feeling frustrated with it? I created the Git Masterclass to solve this problem!


→ Want to actually learn Git? Want to stop feeling frustrated with it? I created the Git Masterclass to solve this problem!

download all my books for free

  • javascript handbook
  • typescript handbook
  • css handbook
  • node.js handbook
  • astro handbook
  • html handbook
  • next.js pages router handbook
  • alpine.js handbook
  • htmx handbook
  • react handbook
  • sql handbook
  • git cheat sheet
  • laravel handbook
  • express handbook
  • swift handbook
  • go handbook
  • php handbook
  • python handbook
  • cli handbook
  • c handbook

subscribe to my newsletter to get them

Terms: by subscribing to the newsletter you agree the following terms and conditions and privacy policy. The aim of the newsletter is to keep you up to date about new tutorials, new book releases or courses organized by Flavio. If you wish to unsubscribe from the newsletter, you can click the unsubscribe link that's present at the bottom of each email, anytime. I will not communicate/spread/publish or otherwise give away your address. Your email address is the only personal information collected, and it's only collected for the primary purpose of keeping you informed through the newsletter. It's stored in a secure server based in the EU. You can contact Flavio by emailing flavio@flaviocopes.com. These terms and conditions are governed by the laws in force in Italy and you unconditionally submit to the jurisdiction of the courts of Italy.

Related posts about git: