{"id":17424,"date":"2022-06-04T04:57:46","date_gmt":"2022-06-04T04:57:46","guid":{"rendered":"https:\/\/linuxways.net\/?p=17424"},"modified":"2022-06-04T04:57:46","modified_gmt":"2022-06-04T04:57:46","slug":"how-to-install-git-on-debian-11","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/how-to-install-git-on-debian-11\/","title":{"rendered":"How to Install Git on Debian 11"},"content":{"rendered":"<p>Git is an open-source distributed version control system. It handles everything related to the code from small to very large scope projects efficiently. It enables developers to upload their code to hosting sites like Github, BitBucket, and Gitlab. It facilitates code management activities such as reverting to prior versions, branching, and so on.<\/p>\n<p>Git is easy to understand and simple to learn, with a minimal footprint and lightning-fast speed. It beats SCM systems like Subversion, CVS, Perforce, and ClearCase etc. and offers complex features including low-cost local branching, handy staging areas, and many operations.<\/p>\n<p>We will demonstrate in this tutorial, how to install the Git version control system on Debian 11 bullseye distribution.<\/p>\n<h2>Install Git on Debian 11 Bullseye Distribution<\/h2>\n<p>By using the two different methods, you can install Git on the Debian 11 system.<\/p>\n<ul>\n<li>Installing Git from Debian repositories by using the APT package manager<\/li>\n<li>Install Git from the source<\/li>\n<\/ul>\n<h3>Method 1: Installing Git from Debian repositories by using the APT package manager<\/h3>\n<p>To start the Git installation, make sure Debian&#8217;s package index is up to date.<\/p>\n<pre>$ sudo apt update<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"721\" height=\"290\" class=\"wp-image-17425\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-144.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-144.png 721w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-144-300x121.png 300w\" sizes=\"auto, (max-width: 721px) 100vw, 721px\" \/><\/p>\n<p>Once all Debian repositories are updated, install Git on Debian 11 by using the following command:<\/p>\n<pre>$ sudo apt install git<\/pre>\n<p>Once the Git installation is complete, check the Git version by using this command:<\/p>\n<pre>$ git \u2013version<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"724\" height=\"59\" class=\"wp-image-17426\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-145.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-145.png 724w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-145-300x24.png 300w\" sizes=\"auto, (max-width: 724px) 100vw, 724px\" \/><\/p>\n<h3>Method 2: Install Git from the source<\/h3>\n<p>Installing Git from the source is a better and more flexible alternative. This is a longer installation method as compared to the above method but it will install the latest version of Git on your system.<\/p>\n<p>First, install all Git dependencies on your system.<\/p>\n<pre>$ sudo apt update<\/pre>\n<p>$ sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"523\" class=\"wp-image-17427\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-146.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-146.png 789w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-146-300x199.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-146-768x509.png 768w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/p>\n<p>Now, jump onto the Git project on GitHub for Git installation<\/p>\n<p><a href=\"https:\/\/github.com\/git\/git\">https:\/\/github.com\/git\/git<\/a>.<\/p>\n<p>Click on the \u2018<strong>Master<\/strong>\u2019 branch and then click on \u2018<strong>Tags<\/strong>\u2019. Here, you can choose the latest Git version. It is recommended that never choose the release candidate version \u2018rc\u2019 for installation that is unstable in the beta version.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"795\" height=\"528\" class=\"wp-image-17428\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-147.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-147.png 795w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-147-300x199.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-147-768x510.png 768w\" sizes=\"auto, (max-width: 795px) 100vw, 795px\" \/><\/p>\n<p>Now, click on the \u2018Code\u2019 and then copy the link to the \u2018Download ZIP\u2019 option.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"776\" height=\"426\" class=\"wp-image-17429\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-148.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-148.png 776w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-148-300x165.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-148-768x422.png 768w\" sizes=\"auto, (max-width: 776px) 100vw, 776px\" \/><\/p>\n<p>Open the terminal on Debian 11 system and download the Git ZIP file using the wget command.<\/p>\n<pre>$ wget\u00a0 https:\/\/github.com\/git\/git\/archive\/refs\/heads\/master.zip -O git.zip<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"790\" height=\"290\" class=\"wp-image-17430\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-149.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-149.png 790w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-149-300x110.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-149-768x282.png 768w\" sizes=\"auto, (max-width: 790px) 100vw, 790px\" \/><\/p>\n<p>Unzip the compressed Git archive and navigate into this directory.<\/p>\n<pre>$ unzip git.zip<\/pre>\n<pre>$ cd git-2.36.1<\/pre>\n<p>Now, to install git from the source run these commands:<\/p>\n<pre>$ sudo make prefix=\/usr\/local all<\/pre>\n<pre>$ sudo make prefix=\/usr\/local install<\/pre>\n<p>Check the git version. At this time, you will notice that the latest Git will be installed on your system.<\/p>\n<pre>$ git --version<\/pre>\n<h2>How to set up Git on Debian 11?<\/h2>\n<p>Above we successfully installed Git on the Debian 11 system. Now, we will see how to set up Git on a Linux system so that the commit messages provide the correct information about the author.<\/p>\n<p>Now, you need to enter your name and email address that will be incorporated in the commit messages. So, use the \u2018git config\u2019 command to apply these changes:<\/p>\n<pre>$ git config --global user.name \"kbuzdar\"<\/pre>\n<pre>$ git config --global user.email \"<a href=\"mailto:kbuzdar@xyz.com\">kbuzdar@xyz.com<\/a>\"<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"799\" height=\"57\" class=\"wp-image-17431\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-150.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-150.png 799w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-150-300x21.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-150-768x55.png 768w\" sizes=\"auto, (max-width: 799px) 100vw, 799px\" \/><\/p>\n<p>To verify all Git configurations, use this command:<\/p>\n<pre>$ git config \u2013list<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"791\" height=\"85\" class=\"wp-image-17432\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-151.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-151.png 791w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-151-300x32.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/word-image-151-768x83.png 768w\" sizes=\"auto, (max-width: 791px) 100vw, 791px\" \/><\/p>\n<p>You can also verify the above configurations by viewing the \u2018~\/.gitconfig\u2019 file.<\/p>\n<pre>$ cat ~\/.gitconfig<\/pre>\n<h2>Conclusion<\/h2>\n<p>We demonstrated how to install Git on the Debian 11 system. Now, you can start using Git to host your code on GitHub or any other supported platform. Developers should have their local copy of the source code repository as a recommended practice. This allows them to work on it without interfering with the rest of their project&#8217;s progress. Thanks!<\/p>","protected":false},"excerpt":{"rendered":"<p>Git is an open-source distributed version control system. It handles everything related to the code from small to very large scope projects efficiently. It enables developers to upload&hellip;<\/p>","protected":false},"author":1,"featured_media":17604,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[521,475],"class_list":["post-17424","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian","tag-debian-11","tag-git"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/17424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=17424"}],"version-history":[{"count":1,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/17424\/revisions"}],"predecessor-version":[{"id":17603,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/17424\/revisions\/17603"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/17604"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=17424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=17424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=17424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}