How to Install Git on Raspberry Pi


3 min read

Install Git on Raspberry Pi

Git is a distributed version control system that’s being used by most software teams today. It allows you to keep track of your code changes, revert to previous stages, create branches , and to collaborate with your fellow developers.

Git is originally developed by Linus Torvalds , the creator of the Linux kernel.

This tutorial explains how to install Git on Raspberry Pi. We’re assuming that you have Raspbian installed on your Raspberry Pi .

For most people, the easiest and the recommended way to install Git is to install it using the apt package management tool.

If you want to install the latest stable version of Git from source, scroll down to the Installing Git from the Source section of this tutorial.

Installing Git with Apt

The Git package is included in the Raspbian’s default repositories.

Run the following command as root or user with sudo privileges to install Git on your Raspberry Pi:

sudo apt updatesudo apt install git

Enter the command below to verify the installation:

git --version

At the time of writing this article, the current version of Git available in the Raspberry Pi repositories is 2.20.1.

git version 2.20.1

That’s it! You have installed Git, and you can start using it.

Installing Git from the Source

Compiling Git from the source allows you to install the latest Git version and to customize the build options. However, you won’t be able to maintain your Git installation through the apt package manager.

Start by installing the dependencies necessary to build Git on Raspbian:

sudo apt updatesudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext

Once the installation is complete, open your browser, visit the Git project’s mirror on GitHub and copy the latest release link URL that ends in .tar.gz:

Installing Git from Source

Currently, the most recent stable Git version is 2.24.1, but it may be different for you.

We are going to download Git source in the /usr/src directory, which is the common location to place source files. Navigate to the directory :

cd /usr/src/

Download the tar.gz file as git.tar.gz using the link you copied earlier:

sudo wget -O git.tar.gz

Next, extract the tarball and change to the git source directory by typing:

sudo tar -xf git.tar.gzcd git-*

Run the following two commands to compile and install Git:

sudo make prefix=/usr/local allsudo make prefix=/usr/local install

Type git --version to verify the installation:

git --version
git version 2.24.1

Later, when a new version is released, to update Git, download the archive and repeat the build process.

Configuring Git

Now that you have Git installed on your Raspberry Pi machine, it is a good idea to set up your personal information. The following commands will set your commit name and email address:

git config --global "Your Name"git config --global ""

To confirm that you have set your information correctly in Git, type:

git config --list Name

The configuration settings are stored in the ~/.gitconfig file:

    name = Your Name
    email =

If you want to make additional changes to the global Git configuration, use either the git config command or edit the ~/.gitconfig file by hand.


Installing Git on Raspberry Pi is a matter of running a single apt command. If you want to use the latest Git version, you’ll need to build it from the source.

With Raspberry Pi, you can set up your own Git server on your local network.

If you are new to Git, check the Pro Git book , which is an excellent resource for learning about how to use Git.

Leave a comment below if you hit a problem or have feedback.