{"id":14132,"date":"2022-01-20T19:30:06","date_gmt":"2022-01-20T19:30:06","guid":{"rendered":"https:\/\/linuxways.net\/?p=14132"},"modified":"2022-01-20T19:30:06","modified_gmt":"2022-01-20T19:30:06","slug":"how-to-install-git-on-rocky-linux-8","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/red-hat\/how-to-install-git-on-rocky-linux-8\/","title":{"rendered":"How to Install Git on Rocky Linux 8"},"content":{"rendered":"<p>Git is a popular version control system used in modern software development. It allows multiple developers to contribute to the same project at the same time while tracking changes, revisions, and contributions. It helps with managing large projects efficiently. Git repositories are hosted on sites like Github and Bitbucket.<\/p>\n<p>This post will show you how to use two different approaches to install Git on RockyLinux 8.<\/p>\n<h2><strong>Install Git from the AppStream <\/strong><\/h2>\n<p>Git is available in Rocky Linux default repositories. The simplest option is to install git from the App stream default repository. The version in the default repository, however, may not be the latest release of git. You should compile and build git from source to obtain the latest version.<\/p>\n<p>To install git via appstream run:<\/p>\n<pre><strong>$ sudo dnf install git<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"378\" class=\"wp-image-14133\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-428.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-428.png 735w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-428-300x154.png 300w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><\/strong><\/p>\n<p>Then, type y and press enter to proceed with the git installation.<\/p>\n<p>Check the version of git installed with the command:<\/p>\n<pre><strong>$ git --version<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"593\" height=\"56\" class=\"wp-image-14134\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-429.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-429.png 593w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-429-300x28.png 300w\" sizes=\"auto, (max-width: 593px) 100vw, 593px\" \/><\/strong><\/p>\n<h2><strong>Install Git from Source<\/strong><\/h2>\n<p>If you wish to install the most recent release of Git you need to compile and build it from source. This will not be maintained by your package manager. First, install the essential Git requirements for RockyLinux 8. Execute the command:<\/p>\n<pre><strong>$ sudo dnf install gettext-devel curl-devel expat-devel openssl-devel perl-CPAN perl-devel zlib-devel unzip cmake gcc make -y<\/strong><\/pre>\n<p>Then, download the latest release of Git from the official site. At the time of writing this guide, version 2.34.1 is the latest stable release. Run the following wget command:<\/p>\n<pre><strong>$ wget <\/strong><a href=\"https:\/\/github.com\/git\/git\/archive\/refs\/tags\/v2.33.0.zip\"><strong>https:\/\/github.com\/git\/git\/archive\/refs\/tags\/v2.34.1.zip<\/strong><\/a><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"763\" height=\"341\" class=\"wp-image-14135\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-430.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-430.png 763w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-430-300x134.png 300w\" sizes=\"auto, (max-width: 763px) 100vw, 763px\" \/><\/strong><\/p>\n<p>Next, extract the contents of the git archive file:<\/p>\n<pre><strong>$ sudo unzip v2.34.1.zip<\/strong><\/pre>\n<p>Then, navigate into the directory:<\/p>\n<pre><strong>$ cd git-2.34.1<\/strong><\/pre>\n<p>Now, execute the commands below to install git:<\/p>\n<pre><strong>$ sudo make prefix=\/usr\/local all<\/strong><\/pre>\n<pre><strong>$ sudo make prefix=\/usr\/local install<\/strong><\/pre>\n<h2><strong>Set up Git<\/strong><\/h2>\n<p>In this step we will configure git so that your commit messages contain the correct information. Use the git config command to configure git for the first time. Provide your name and email address as follows:<\/p>\n<p>First, set up your username globally as shown:<\/p>\n<pre><strong>$ git config --global user.name \"YOUR-NAME\"<\/strong><\/pre>\n<p>Similarly, configure your email as shown:<\/p>\n<pre><strong>$ git config --global user.email \"YOUR-EMAIL\"<\/strong><\/pre>\n<p>To verify that your name and email have been configured:<\/p>\n<pre><strong>$ git config --list<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"780\" height=\"133\" class=\"wp-image-14136\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-431.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-431.png 780w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-431-300x51.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/01\/word-image-431-768x131.png 768w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/><\/strong><\/p>\n<p>Git is now successfully installed and configured in Rocky Linux 8. You can now host and collaborate on your projects more efficiently.<\/p>","protected":false},"excerpt":{"rendered":"<p>Git is a popular version control system used in modern software development. It allows multiple developers to contribute to the same project at the same time while tracking&hellip;<\/p>","protected":false},"author":1,"featured_media":14252,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[165],"tags":[475,436],"class_list":["post-14132","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-red-hat","tag-git","tag-rocky-linux-8"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/14132","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=14132"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/14132\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/14252"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=14132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=14132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=14132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}