How to Install Git on Fedora Linux

GIT is a free, open-source version control system that can efficiently manage small or huge projects. The following tutorial will teach you how to install the latest or upgrade GIT on Fedora Linux using the command line terminal and some basic commands and tips on using GIT cli commands.

Update Fedora

First, update your system to ensure all existing packages are up to date.

sudo dnf upgrade --refresh

Install Git

By default, GIT is present and always up-to-date on Fedora, making the installation straightforward by running the following command.

sudo dnf install git -y

GIT Configuration & Setup on Fedora Linux

The following parts will cover some typical setups and commands used daily by users of GIT. This is not the complete list, GIT has a vast amount of commands and configurations, but newer users may find some of the following examples helpful. I would check out the Git documentation for more information in the long term for users seeking more advanced requirement options or usage.

GIT Add user

After installation, you must set up standard settings such as names and e-mails, mainly around git commit messages. This is pretty straightforward, as the tutorial will explain below.

The first step is to provide your name that will be set Globally.

git config --global "YOUR NAME"

Next, select your e-mail; this can be fake if you prefer.

git config --global "YOUR EMAIL"

GIT Create Directory

First, create a directory for users who want to make a new directory strictly for GIT.

mkdir example-directory -p

Next, navigate to the directory.

cd example-directory -p

The next task is to use the initialization command, and this will create a hidden .git directory to store the configuration, history, and so on.

git init

You will see a terminal output stating the status of the directory being initialized, and you can additionally see the content using the following command.

ls -a .git

Print GIT CONFIG Details

To confirm GIT config users and details, use the config –list command

git config --list

Unless specified, Git stores details in the ~/.gitconfig file. You can review what is currently stored by using the cat command.

cat ~/.gitconfig

The sudo command with the git config command will set two separate user names and e-mails.

Store GIT Credentials

For users who want to keep authorization details stored, you can enable the credential helper cache using the following.

git config --global credential.helper cache

If you must use credential helper, it is advised to cache only for a limited time for increased security. For example, if you will be working today using GIT for 1 to 4 hours but won’t be touching it for maybe a few weeks, then set the expiry for 5 hours.

git config --global credential.helper "cache --timeout=18000"

After 5 hours, the credentials will be deleted, securing your GIT.

Check Directory GIT Status

To view the status of a GIT repository, you can use the following git status command.

git status

While the above command helps with giving a status of the GIT, you can additionally list all git commands and sub.

Connect Remote GIT Repository

For users that need to work with GIT remotes to sync and download/upload changes, you will need to link the GIT. This can be done using the git remote command as follows.

git remote add origin remote-repository-link

Commit GIT Changes

When you have completed changes in your GIT directory and want to SYNC it to push to the remote repository, use the following git commit command.

git commit -m "git message changelog"

Note the -m “git message change” is the message that appears in the changelog.

Push GIT Changes

To push or send changes to the remote repository to SYNC in both versions, use the following git push command.

git push origin master

Pull GIT Changes

Alternatively, to pull or get changes from the remote repository to SYNC in both versions, use the following git push command.

git pull origin master

Additional Commands & Tips

How to Update Git

For updates to GIT, they will be included with your standard system packages as you installed git-core with the DNF package manager. Use the following command to update and upgrade.

sudo dnf update --refresh

How to Remove Git

For users who no longer want GIT installed, run the following command to remove the application and any unused dependencies.

sudo dnf autoremove git


This small tutorial has demonstrated how to install Git using the command line terminal on Fedora Linux. For further reading, I suggest visiting the Documentation from the official Git website.

Share to...