Advance

Tutorial Install Git on CentOS 8

Tutorial Install Git on CentOS 8
1
(1)

Git is one of the most popular, easy to use, and suitable version control systems. To work better with modern software development, you must know about version control systems which you will found it as an indispensable part. In case you need to keep track of your software at the source level, continue reading this tutorial. With this tool on your vps, you will be able to changes, revert to previous stages, and the branch to create alternate versions of files and directories.

With Git you can see the way many projects’ files are maintained in it. Then, feel free to use GitHub, GitLab, and Bitbucket to help you to facilitate software development project sharing and collaboration.

 

 

To let this tutorial work better, please consider the below Prerequisites:

  • A non-root user with sudo privileges or root user access
  • To set up, follow our Initial server set up for CentOS 8

 

Recommended Article: How to Install CloudLinux on CyberPanel

Tutorial Install Git on CentOS 8

Join us with the tutorial Install Git on CentOS 8 to show you how to install and configure Git on a CentOS 8 server. Keep continuing to learn two different ways of installing the software and verify which one is more useful and finally, you will choose the way which covers your benefits better.

 

How To Install Git on CentOS 8 with Default Packages

Let’s imagine you need to get up and running quickly with Git. in this case the best option is to install Git is via CentOS’s default packages. With this, you would have a widely-used stable version and no need to look for the newest available options. In the following, you see how to use the open-source package manager tool DNF, which stands for Dandified YUM the next-generation version of the Yellowdog Updater, Modified. But what is the DNF? it is a package manager that is now the default package manager for RedHat based Linux systems like CentOS. Using DNF, you can install, update, and remove software packages on your server.

However, to use the DNF package management tools to update your local package index, run the below command.

sudo dnf update -y

As you guess, to alert the system for being aware that you are making changes and preventing the terminal from prompting you to confirm, the -y flag is needed.

Once the update is completed, begin the Git installation.

sudo dnf install git -y

Use the following command to confirm that you have installed Git correctly.

git --version
Output
git version 2.18.2

 

 

 

How To Install Git on CentOS 8 from Source

Compiling the software from the source is a more flexible way of installing Git. Although you may feel it would take longer and will not be maintained through your package manager. Instead of that you will be allowed to download the latest release and will give you some control over the options you include if you wish to customize.

Available in the default repositories, install the software that Git depends on, and then you will be ready to start. To update your local package index and then install the packages use the commands below.

sudo dnf update -y  sudo dnf install gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel gcc autoconf -y

You should create a temporary directory and move into the necessary dependencies which you have installed recently. To see where you will download your Git tarball.

mkdir tmp  cd /tmp

Please be aware that you can use the Git Project website for navigating to the RedHat Linux distribution tarball list to download the version you would like.

However, you can use curl and output the file we download to git.tar.gz.

curl -o git.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.26.0.tar.gz

And then unpack the compressed tarball file:

tar -zxf git.tar.gz

Now, move into the new Git directory:

cd git-*

Also, you can make the package and install it by typing these two commands:

make prefix=/usr/local all  sudo make prefix=/usr/local install

Till here and if you see all is OK, you can be sure that your install was successful by checking the version too.

git --version
Output
git version 2.26.0

 

 

 

How to Set Up Git

It is time to configure the Git after installing it successfully. And the generated commit messages will contain your correct information. To begin, use the git config command. Remember that you must consider a name and email address because Git embeds this information into each commit you do. So use the following command to reach this purpose.

Note: Do not forget to replace your considered name and email in the prompted lines of commands.

git config --global user.name "Your Name"  git config --global user.email "[email protected]"

Next, type the below command to display all of the configuration items that have been set.

git config --list
Output
user.name=Your Name  [email protected]  

Git has stored your information in its configuration file. And you can optionally edit by hand with a text editor like this:

vi ~/.gitconfig
[user]    name = Your Name    email = [email protected]

Finally, press ESC then: q to exit the text editor.

 

 

 

Conclusion

In this article, you learned about Git and why you need to use it. We showed you how to Install Git on CentOS 8 and if you are interested in involving more about its functions, have a look at our related articles on How To Install Composer on Debian 10 OR How To Install the Django on Ubuntu 18.04.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

View More Posts
Tom Veitch
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

20 thoughts on “Tutorial Install Git on CentOS 8

    1. I guess we can easily say Yes! Since about 6355 companies are using Git in their tech stacks. I can name including Netflix, Shopify, and reddit.

    1. Yes, I see the faulty commits do occasionally make it into the central repository. Try an easy way to revert.
      git revert c761f5c
      git revert HEAD^
      git revert develop~4..develop~2

    1. Yes you are right. But if you use the binary search facility which Git has presented, it would be much easier. To perform the initial setup runs the commands below:
      git bisect start
      git bisect bad
      git bisect good revision

    1. Very easy, you need to run your space again and mark the commit as ‘’good’’ or ‘’bad’’
      git bisect good

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day