In this detailed guide, we have demonstrated how to install Git on Debian 11.
Install Git on Debian 11
The following are the ways to install Git on Debian 11:
Method 1: Install Git Using the apt
The Git is present in the default repository of Debian, you can easily install it on the system using the single command. Before installing Git, update and upgrade your system via the apt command as shown below:
Once the system is up to date, execute the below-given command to install Git on Debian 11:
After the successful installation of Git, run the version command to check if it’s properly installed on the system or not:
Method 2: Install Git Using the Source
You can install Git latest version on Debian 11 through the source method that first requires installing the following dependencies on Debian 11:
Next, execute the following wget command to get the Git Zip file directly from the source:
Unzip the downloaded file by executing the following command:
Move to the git-master directory on the system:
The next step is to install the version controls the system from the source, for this first execute the following command:
The above command will take some time, once it executed, run the following command to install the Git related files on the system.
The Git latest version is installed on your Debian 11 and you can verify the installation via the following command:
Configure Git on Debian 11
Once the installation procedure is completed, you have to configure and set up Git on Debian 11. Execute the following command and replace the <linuxhint> with your name:
Enter the email address to complete the configuration of Git:
You can verify the modifications via the following command:
All the configurations of the git are stored in the git config file which is in the home directory. To access the file, execute the following commands:
You can also edit the file by typing the following command in the terminal:
Remove the Git on Debian 11
To remove Git from Debian, enter the following command:
Bottom Line
Git allows the developers to use or collaborate with the source code, during the development of their programs. You can use Git to host your code on GitHub and it also facilitates the code management activities like branching. In the above section of the guide, we have listed the two ways to install Git on Debian. If anyone of the fails, you can try the alternate way. We have also mentioned the configuration and removal method of Git on Debian.