Installing Git on CentOs

2020-06-12 06:35发布

问题:

I want to install git on CentOs, i'm running this command

yum install git-core

But the problem is, I am getting these errors:

Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * epel: mirrors.solfo.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.7.1-3.el6_4.1 will be installed
--> Processing Dependency: perl-Git = 1.7.1-3.el6_4.1 for package: git-1.7.1-3.e
l6_4.1.x86_64
--> Processing Dependency: perl(Git) for package: git-1.7.1-3.el6_4.1.x86_64
--> Processing Dependency: perl(Error) for package: git-1.7.1-3.el6_4.1.x86_64
--> Finished Dependency Resolution
Error: Package: git-1.7.1-3.el6_4.1.x86_64 (updates)
           Requires: perl-Git = 1.7.1-3.el6_4.1
Error: Package: git-1.7.1-3.el6_4.1.x86_64 (updates)
           Requires: perl(Error)
Error: Package: git-1.7.1-3.el6_4.1.x86_64 (updates)
           Requires: perl(Git)
 You could try using --skip-broken to work around the problem
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
frontpage-2002-SR1.2.i386 has missing requires of libexpat.so.0
sendmail-cf-8.14.4-8.el6.noarch has missing requires of sendmail = ('0', '8.14.4
', '8.el6')

How can I managed to solved that one?

回答1:

This blog article by lishevita mentions:

It turns out, Cpanel blocks installation of any perl packages through yum in order to make sure that nothing interferes with their customized packages.
Pain in the NECK!

The good news is that the perl packages that git needs won't mess with Cpanel, so you can go ahead and install them.
Yum has a spiffy one time option to let you get around the excluded package problem.

yum --disableexcludes=main install git

I searched ALL OVER for this little tidbit, and only found it this post by Nick Andreson.
Hopefully, having this post, and the link back to his post will help improve searches in the future so that you find your answer more easily!! (And thanks, Nick for your post!)

Or you can use cPanel's own git located:

root@CentOS-cPanel-box [/]# /usr/local/cpanel/3rdparty/bin/git --version
git version 1.8.3.4


回答2:

i had the same issue installing git on a remote server and after searching a while i found a gcc dependency the way to resolve it is yum -y install gcc after that yum -y install git

i hope that this can help

find out if everything was ok by searching for the git which git it should give you a path to the git installation and for been more shure git --version



标签: git