Skip to main content

Command Palette

Search for a command to run...

How to Install Git on Ubuntu

Published
3 min read
How to Install Git on Ubuntu
P

As an experienced Linux user and no-code app developer, I enjoy using the latest tools to create efficient and innovative small apps. Although coding is my hobby, I still love using AI tools and no-code platforms.

Git is an extremely popular open-source distributed version control system. It allows you to track changes made to your code projects efficiently. If you want to contribute to open-source software or collaborate with other developers on coding projects, you'll need git installed locally.

The good news is that installing git on Ubuntu Linux is quick and easy, usually requiring just one command. In this simple tutorial, we'll walk through everything you need to get git up and running on an Ubuntu machine.

Prerequisites

Before installing Git, make sure your Ubuntu system is fully updated:

sudo apt update
sudo apt upgrade

This makes sure you grab the latest security patches and app versions, which is good practice in general.

The other prerequisite is having curl installed, which is usually present by default, but verified with:

curl --version

If curl is not already present, install it by running:

sudo apt install curl

That's it! Now you're ready to install git.

Install Git on Ubuntu

To install the latest stable version of git on Ubuntu, simply run:

sudo apt install git

This downloads and installs git from Ubuntu's default repositories. Easy!

Verify the install worked by checking git's version:

git --version

And that's all there is to it! You now have git installed and ready to use on Ubuntu.

Initial Git Setup

Once git is installed, you'll want to do some initial configuration. Namely, setting your:

  • Username: Makes it clear who contributed which commits. Set via git config --global user.name "Your Name"

  • Email: Your email is used for commit messages and notifications. Set with git config --global user.email "you@email.com"

For example:

git config --global user.name "Mona Lisa" 
git config --global user.email "mona@example.com"

That sets up git's identity so it can properly track your work.

Cloning a Git Repository

At this point, git is installed and configured!

You can start using it by cloning git repositories from sites like GitHub onto your local Ubuntu machine:

git clone https://github.com/user/repo.git

That downloads the repository into a new repo directory, allowing you to work locally.

Some basic git commands, like git add, git commit, and git push will then let you stage file changes, commit them, and push local commits back up to GitHub.

But covering full git usage is outside the scope here - check out tutorials for those details on leveraging git fully once it's installed on Ubuntu.

Upgrading Git in the Future

To upgrade git in the future when new versions come out, simply run:

sudo apt update
sudo apt install git

The apt package manager will grab the latest git release automatically.

Conclusion

Getting git setup on Ubuntu Linux is quick and easy - usually just:

sudo apt install git

Then some initial configuration with your name and email using git config.

With git installed, you're ready to start version controlling your projects locally!

More from this blog

T

TheTechDeck | Tech Made Simple for Everyone

772 posts

Explore the best tech tips and tricks for Windows, Mac, Linux, Android, and gaming. Simplify tech with TechUvy's expert guides