instalar-git-en-raspberry-pi

How to Install and Use Git on Raspberry Pi

  • 3 min

In this post, we will explore how to install and configure Git on a Raspberry Pi. Git is a distributed version control system widely used in software development to manage source code, track changes, and collaborate with other developers.

Setting up Git on your Raspberry Pi will allow you to integrate your device into a collaborative development workflow and manage your programming projects more efficiently.

What is Git

Git is a distributed version control system created by Linus Torvalds in 2005. Git allows you to:

  • Track changes: Keep a record of changes made to the source code over time.
  • Branching and merging: Work on different development branches and merge them efficiently.
  • Collaboration: Facilitate collaboration among multiple developers on the same project.

Git is essential for managing software projects, both large and small, from personal projects to team collaborations.

Installing Git

First, we update the system before installing new packages. Open the terminal and run the following commands:

sudo apt update sudo apt upgrade

Then, install Git, which is available in the Debian and Raspberry Pi OS repositories, using this command:

sudo apt install git

To verify that Git has been installed correctly, check its version with:

git —version

We should see a message similar to git version 2.x.x, where 2.x.x is the installed version.

Initial Git Configuration

After installing Git, perform a basic configuration to personalize user information. This configuration is used in commits to identify who made the changes.

Set your name and email with the following commands. Replace "Your Name" and "[email protected]" with your information:

git config —global user.name “Your Name” git config —global user.email “[email protected]

These settings are stored in the ~/.gitconfig file and apply to all Git repositories for your user.

To confirm that the configuration has been applied correctly, use the following command:

git config —list

You should see the user information you configured, along with other default settings.

Basic Git Usage

With Git installed and configured, you can start working with repositories. Below are some basic commands to familiarize yourself with the Git workflow.