Can I get Git on Raspbian to back-up my C/C++ files?

Do I need to download anything to use Git on my Raspberry Pi?

Where can I learn to use it?

  • 1
    As and addition to lenik's answer: If you want to back up your work, and you don't mind open-sourcing your work, you can also use one of the free hosting sites to push your changes to. Github comes to mind, but there are many more. Github also has a tutorial on setting up git and connecting it to github.
    – Arne
    Commented Jul 29, 2013 at 7:56
  • 3
    Code school has a free introductory Git course if you prefer a more interactive approach: codeschool.com/courses/try-git
    – Kenneth
    Commented Jul 29, 2013 at 8:12
  • 1
    The "Pro Git" book is good, and free online: git-scm.com/documentation
    – goldilocks
    Commented Jul 29, 2013 at 13:27

7 Answers 7


You may use:

$ sudo apt-get install git

to install Git and then read the Pro Git book (by Scott Chacon and Ben Straub) about how to use it.


Like what Lenik said, install Git using:

sudo apt-get install git

To back-up your C/C++ files, I suggest creating a free account on the popular GitHub. After registration, they provide a newbie-friendly guide on how to configure and use Git to upload code into repositories. The only downside using this method is your code will become public unless you pay for a private repository.

  • 3
    Bitbucket offers an unlimited number of private repositories for free.
    – n.st
    Commented Dec 17, 2014 at 15:08
  • 2
    @n.st as do GitHub now :)
    – James
    Commented Jan 18, 2019 at 12:03

Yes, you can install Git with sudo apt-get install git. In fact, I think it is already installed on some versions.
You'll need to configure it with

git config --global user.name "Your Name"
git config --global user.email [email protected] 

The Pro Git book can teach you how to use it, or try the tutorials on raspberrypi.org or Adafruit. GitHub also has some tutorials on there.
I have successfully installed Git on my Raspberry Pi recently and created a repository. I am now having some problems pushing it to GitHub but I know some people have done it successfully.
It's probably a good idea to put your code on GitHub or BitBucket. BitBucket gives you unlimited private repositories for free, but GitHub is still the most popular.
Getting Started With Git


I fired it up recently and git was already installed. Might want to check that first.

git --version

The posts in this thread were correct when it was started in July of 2013. But it's now 2018, and some of the information in this thread is no longer correct. Specifically, git is no longer installed by default on Raspbian. For example, git is not installed by default on Raspbian Stretch Lite.

That said, the sequence for installing git is:

df -h

sudo apt-get update

sudo apt-get dist-upgrade

sudo apt-get install git

sudo apt-get clean

The first command (df -h) will give you a chance to make sure you've got space on your "drive" for the installation. This is important as apt doesn't verify this before it starts! The last command (sudo apt-get clean) will "take out the trash", and help conserve space on your "drive".


Or if you want to make your Raspberry Pi a local Git Repository Server - you could do it with Git Lab https://about.gitlab.com/2015/04/21/gitlab-on-raspberry-pi-2/


It should be inside the repository for Debian, and probably others like Pidora would have it too.


sudo apt-get install git

That should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.