How To Install Git on Raspberry Pi

How To Install Git on Raspberry Pi

All

Linux Articles / All 50 Views comments

Git is a distributed model management system that’s being utilized by most software program groups as we speak. It permits you to maintain monitor of your code modifications, revert to earlier levels, create branches, and to collaborate together with your fellow builders.

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

This tutorial explains the way to set up Git on Raspberry Pi. We’re assuming that you've Raspbian installed on your Raspberry Pi.

For most individuals, the simplest and the beneficial approach to set up Git is to put in it utilizing the apt package deal administration device.

If you wish to set up the newest secure model of Git from supply, scroll right down to the Installing Git from the Source part of this tutorial.

Putting in Git with Apt

The Git package deal is included within the Raspbian's default repositories.

Run the next command as root or user with sudo privileges to put in Git in your Raspberry Pi:

sudo apt replacesudo apt set up git

Enter the command under to confirm the set up:

git --version

On the time of writing this text, the present model of Git out there within the Raspberry Pi repositories is 2.20.1.

git model 2.20.1

That is it! You will have put in Git, and you can begin utilizing it.

Putting in Git from the Supply

Compiling Git from the supply permits you to set up the newest Git model and to customise the construct choices. Nevertheless, you will not be capable of keep your Git set up via the apt package deal supervisor.

Begin by putting in the dependencies vital to construct Git on Raspbian:

sudo apt replacesudo apt set up make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext

As soon as the set up is full, open your browser, go to the Git project’s mirror on GitHub and replica the newest launch hyperlink URL that ends in .tar.gz:

At present, the newest secure Git model is 2.24.1, however it might be totally different for you.

We're going to obtain Git supply within the /usr/src listing, which is the widespread location to put supply information. Navigate to the directory:

cd /usr/src/

Obtain the tar.gz file as git.tar.gz utilizing the hyperlink you copied earlier:

sudo wget https://github.com/git/git/archive/v2.24.1.tar.gz -O git.tar.gz

Subsequent, extract the tarball and alter to the git supply listing by typing:

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

Run the next two instructions to compile and set up Git:

sudo make prefix=/usr/native allsudo make prefix=/usr/native set up

Sort git --version to confirm the set up:

git --version
git model 2.24.1

Later, when a brand new model is launched, to replace Git, obtain the archive and repeat the construct course of.

Configuring Git

Now that you've Git put in in your Raspberry Pi machine, it's a good suggestion to arrange your private info. The next instructions will set your commit identify and e mail handle:

git config --global consumer.identify "Your Identify"git config --global consumer.e mail "youremail@yourdomain.com"

To verify that you've set your info appropriately in Git, sort:

git config --list
consumer.identify=Your Identify
consumer.e-mail=youremail@yourdomain.com

The configuration settings are saved within the ~/.gitconfig file:

~/.gitconfig

[user]
    identify = Your Identify
    e mail = youremail@yourdomain.com

If you wish to make further modifications to the worldwide Git configuration, use both the git config command or edit the ~/.gitconfig file by hand.

Conclusion

Putting in Git on Raspberry Pi is a matter of operating a single apt command. If you wish to use the newest Git model, you will have to construct it from the supply.

With Raspberry Pi, you'll be able to set up your own Git server in your native community.

In case you are new to Git, examine the Pro Git book, which is a wonderful useful resource for studying about the way to use Git.

Depart a remark under in case you hit an issue or have suggestions.

Comments