Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Opensource»How To Install Git on Fedora Linux

    How To Install Git on Fedora Linux

    RahulBy RahulFebruary 10, 20222 Mins ReadUpdated:May 31, 2022

    Git is a free and open-source distributed version control system. It is designed to handle small to very large projects with speed and efficiency.

    This article will help you to install the latest Git client on Fedora Linux systems.

    Method 1. Installing Git using DNF

    The default Fedora repositories also contain the Git packages. But it contains an older version. You can use the following command to install the available git client on the Fedora system.

    sudo dnf install git 
    

    Method 2. Installing Latest Git from Source

    1. Firstly we need to make sure that we have installed the required packages on your system. Use the following command to install all the required packages for source code compilation.
      sudo dnf install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker 
      
    2. Now remove any prior installation of Git through RPM file or Yum package manager. If your older version is also compiled through source, then skip this step.
      yum remove git 
      
    3. Download git source code from kernel git or simply use following command to download Git 2.0.5.
      cd /usr/src 
      wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.36.1.tar.gz 
      tar xzf git-2.36.1.tar.gz 
      
    4. After downloading and extracting the Git source code, Use the following command to compile the source code.
      cd git-2.36.1 
      sudo make prefix=/usr/local/git all 
      sudo make prefix=/usr/local/git install 
      
    5. Now, configure the PATH environment variable.
      echo "PATH=$PATH:/usr/local/git/bin" | sudo tee -a /etc/environment 
      source /etc/environment 
      
    6. Once completing the above steps, you have successfully installed Git in your system. Let’s use the following command to check the git version
      git --version 
      
      git version 2.36.1
      

    Conclusion

    This tutorial helped you to install the latest Git client on the Fedora Linux system.

    fedora git git client git-scm
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Increase Request Timeout in NGINX
    Next Article How to Install Python 3.10 on CentOS/RHEL 8 & Fedora 36/35

    Related Posts

    How to Create Empty Branch in Git Repository

    1 Min Read

    How to Install Latest Git on Ubuntu 22.04

    Updated:May 31, 20222 Mins Read

    How To Install Apache Solr 9.0 on Fedora 36/35

    Updated:May 26, 20223 Mins Read

    How To Add a Git Remote Repository

    3 Mins Read

    How to Git Reset to Head

    Updated:November 3, 20213 Mins Read

    How to Delete a File on Git

    3 Mins Read

    15 Comments

    1. Guru on November 2, 2018 4:15 am

      This has worked fine.

      But does it changes the bash_profile in user’s home directory ?
      what does command “source /etc/bashrc” exactly does. ?

      Also, in case if we need to revert the installed git, then what the procedure for it ?.

      Reply
    2. Bharath on April 16, 2018 11:47 am

      Thanks! Was stuck at 1.7.1 with yum update not helping. These steps got me to 2.17 in no time!

      Reply
    3. Aleksandar on February 27, 2018 7:49 am

      Thanks man, this really helped me on CentOS 6.9. I was struggling to update it from 1.7.1 to some newer version, and this article helps me to do it in few minutes!

      Reply
    4. Petr on March 15, 2016 12:21 pm

      Hi,

      I was looking for a way how to bring latest Git to REHL 6 and there’s another, much easier way. Use Rackspace’s IUS repositories, they have rpms for latest Git version.

      Regards,
      P.

      Reply
      • Chef on May 2, 2016 11:28 pm

        Can you include the full command line sequence for doing this, assuming you’re on a system that does not have those repositories?

        Reply
        • Wyllyam79 on March 27, 2018 8:59 pm

          install Rackspace repo: https://support.rackspace.com/how-to/install-epel-and-additional-repositories-on-centos-and-red-hat/

          and then:
          sudo yum install yum-plugin-replace
          sudo yum replace git –replace-with git2u

          Reply
    5. Jim P. on February 14, 2016 12:58 am

      Used this to install Git 2.7.1 on HostGator VPS running CentOS 6.5. Worked like a charm. Thank you so much.

      Reply
    6. Gunita on January 5, 2016 6:57 pm

      I did the installation, everything went successfully. But now when I do git –version, it shows version 1.7.1 instead of version 2.0.5

      Reply
    7. Srinivasan AC on October 12, 2015 8:49 am

      I am getting below error… Can you help out.. I am trying this on RHEL7

      [[email protected] git-2.5.0]# make prefix=/opt/git all
      CC credential-store.o
      In file included from credential-store.c:1:0:
      cache.h:21:18: fatal error: zlib.h: No such file or directory
      #include
      ^
      compilation terminated.
      make: *** [credential-store.o] Error 1
      [[email protected] git-2.5.0]

      Reply
      • Josh Sklar on October 14, 2015 11:53 pm

        Not having the zlib.h file most likely means that you didn’t install the zlib-devel package. Try doing that yum install zlib-devel step again.

        Reply
    8. Gerard on July 10, 2015 12:36 am

      Please ignore previous comment!

      Reply
    9. Gerard on July 10, 2015 12:35 am

      Great article

      You may also want to update to include; yum install openssl-devel

      Cheers

      Reply
    10. Seemab on July 2, 2015 10:59 am

      Hi,

      This is simply amazing, it helps me a lot.
      Simply luv you for this article.

      Reply
    11. Phila on June 4, 2015 9:07 am

      Thanks buddy, it worked for me. Much appreciation!!

      Reply
    12. Simon Smith on October 20, 2014 11:37 pm

      This worked well, thanks!

      Had to ensure I exported the Git path though. In .bash_profile or other startup dotfile:

      export PATH=$PATH:/usr/local/git/bin

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to run “npm start” through docker
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.