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!
I wrote 21 books to help you become a better developer:
- HTML Handbook
- Next.js Pages Router Handbook
- Alpine.js Handbook
- HTMX Handbook
- TypeScript Handbook
- React Handbook
- SQL Handbook
- Git Cheat Sheet
- Laravel Handbook
- Express Handbook
- Swift Handbook
- Go Handbook
- PHP Handbook
- Python Handbook
- Linux Commands Handbook
- C Handbook
- JavaScript Handbook
- Svelte Handbook
- CSS Handbook
- Node.js Handbook
- Vue Handbook