在使用git时,出现“git: command not found”的情况,于是使用yum安装:

[root@localhost ~]# yum install -y git
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
  * base: centos.ustc.edu.cn
  * extras: centos.ustc.edu.cn
  * updates: centos.ustc.edu.cn
Setting up Install Process
No package git available.
Nothing to do


需要先添加EPEL(Extra Packages for Enterprise Linux) repository:
[root@localhost ~]# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Retrieving http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
warning: /var/tmp/rpm-xfer.GsvZWW: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing...                               ########################################### [100%]
     1:epel-release                     ########################################### [100%]


现在可以使用yum安装了
[root@localhost ~]#  yum install -y git
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
  * base: centos.ustc.edu.cn
  * epel: mirrors.ustc.edu.cn
  * extras: centos.ustc.edu.cn
  * updates: centos.ustc.edu.cn
epel                                                                                                                                                         | 3.4 kB        00:00        
epel/primary_db                                                                                                                                   | 3.1 MB        00:01        
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package git.i386 0:1.7.4.1-1.el5 set to be updated
--> Processing Dependency: perl-Git = 1.7.4.1-1.el5 for package: git
--> Processing Dependency: perl(Error) for package: git
--> Processing Dependency: perl(Git) for package: git
--> Running transaction check
---> Package perl-Error.noarch 1:0.17010-1.el5 set to be updated
---> Package perl-Git.i386 0:1.7.4.1-1.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================
  Package                                   Arch                                 Version                                                 Repository                  Size
========================================================================================================
Installing:
  git                                           i386                                 1.7.4.1-1.el5                                     epel                            4.5 M
Installing for dependencies:
  perl-Error                             noarch                             1:0.17010-1.el5                                 epel                              26 k
  perl-Git                                 i386                                 1.7.4.1-1.el5                                     epel                              28 k

Transaction Summary
========================================================================================================
Install             3 Package(s)
Upgrade             0 Package(s)

Total download size: 4.5 M
Downloading Packages:
(1/3): perl-Error-0.17010-1.el5.noarch.rpm                                                                             |   26 kB        00:00        
(2/3): perl-Git-1.7.4.1-1.el5.i386.rpm                                                                                     |   28 kB        00:00        
(3/3): git-1.7.4.1-1.el5.i386.rpm                                                                                               | 4.5 MB        00:02        
--------------------------------------------------------------------------------------------------------
Total                                                                                                                                     1.4 MB/s | 4.5 MB        00:03        
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 217521f6
epel/gpgkey                                                                                                                                           | 1.7 kB        00:00        
Importing GPG key 0x217521F6 "Fedora EPEL <epel@fedoraproject.org>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
   Installing         : perl-Error                                                                                                                                             1/3
   Installing         : perl-Git                                                                                                                                                 2/3
   Installing         : git                                                                                                                                                           3/3

Installed:
   git.i386 0:1.7.4.1-1.el5                                                                                                                                                          

Dependency Installed:
   perl-Error.noarch 1:0.17010-1.el5                                       perl-Git.i386 0:1.7.4.1-1.el5                                    

Complete!

[root@localhost ~]#





Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐