美文网首页
git卸载和安装

git卸载和安装

作者: summer琴 | 来源:发表于2020-04-01 10:30 被阅读0次

1、yum卸载

[root@liuqin ~]# yum list installed | grep git
crontabs.noarch                         1.11-6.20121102git.el7         @anaconda
git.x86_64                              1.8.3.1-20.el7                 @updates 
libglvnd.x86_64                         1:1.0.1-0.8.git5baa1e5.el7     @base    
libglvnd-egl.x86_64                     1:1.0.1-0.8.git5baa1e5.el7     @base    
libglvnd-glx.x86_64                     1:1.0.1-0.8.git5baa1e5.el7     @base    
linux-firmware.noarch                   20170606-56.gitc990aae.el7     @anaconda
lm_sensors-libs.x86_64                  3.4.0-4.20160601gitf9185e5.el7 @base    
net-tools.x86_64                        2.0-0.22.20131004git.el7       @base    
xdg-utils.noarch                        1.1.0-0.17.20120809git.el7     @base

以上git.x86_64说明已安装

[root@liuqin ~]# yum remove git
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.8.3.1-20.el7 will be erased
--> Processing Dependency: git = 1.8.3.1-20.el7 for package: perl-Git-1.8.3.1-20.el7.noarch
--> Processing Dependency: git for package: gettext-devel-0.19.8.1-2.el7.x86_64
--> Running transaction check
---> Package gettext-devel.x86_64 0:0.19.8.1-2.el7 will be erased
---> Package perl-Git.noarch 0:1.8.3.1-20.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================
 Package                                    Arch                                Version                                        Repository                             Size
===========================================================================================================================================================================
Removing:
 git                                        x86_64                              1.8.3.1-20.el7                                 @updates                               22 M
Removing for dependencies:
 gettext-devel                              x86_64                              0.19.8.1-2.el7                                 @base                                 1.4 M
 perl-Git                                   noarch                              1.8.3.1-20.el7                                 @updates                               57 k

Transaction Summary
===========================================================================================================================================================================
Remove  1 Package (+2 Dependent packages)

Installed size: 24 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Erasing    : gettext-devel-0.19.8.1-2.el7.x86_64                                                                                                                     1/3 
  Erasing    : git-1.8.3.1-20.el7.x86_64                                                                                                                               2/3 
  Erasing    : perl-Git-1.8.3.1-20.el7.noarch                                                                                                                          3/3 
  Verifying  : perl-Git-1.8.3.1-20.el7.noarch                                                                                                                          1/3 
  Verifying  : gettext-devel-0.19.8.1-2.el7.x86_64                                                                                                                     2/3 
  Verifying  : git-1.8.3.1-20.el7.x86_64                                                                                                                               3/3 

Removed:
  git.x86_64 0:1.8.3.1-20.el7                                                                                                                                              

Dependency Removed:
  gettext-devel.x86_64 0:0.19.8.1-2.el7                                                  perl-Git.noarch 0:1.8.3.1-20.el7                                                 

Complete!

卸载完毕

2、rpm卸载

[root@liuqin ~]# rpm -qa | grep git
crontabs-1.11-6.20121102git.el7.noarch
libglvnd-egl-1.0.1-0.8.git5baa1e5.el7.x86_64
xdg-utils-1.1.0-0.17.20120809git.el7.noarch
net-tools-2.0-0.22.20131004git.el7.x86_64
libglvnd-1.0.1-0.8.git5baa1e5.el7.x86_64
git-1.8.3.1-20.el7.x86_64
libglvnd-glx-1.0.1-0.8.git5baa1e5.el7.x86_64
lm_sensors-libs-3.4.0-4.20160601gitf9185e5.el7.x86_64
linux-firmware-20170606-56.gitc990aae.el7.noarch

git-1.8.3.1-20.el7.x86_64为已安装版本

[root@liuqin ~]# rpm -e git
error: Failed dependencies:
    git = 1.8.3.1-20.el7 is needed by (installed) perl-Git-1.8.3.1-20.el7.noarch
    git is needed by (installed) gettext-devel-0.19.8.1-2.el7.x86_64

以上说明有依赖关系,可用--nodeps不查找依赖关系卸载

rpm -e --nodeps git

3、源码安装卸载

如果以上两种方式试过之后,命令行输入git仍然能显示该命令存在,那你可能需要使用这种方式了

[root@liuqin ~]# which -a git
/usr/local/git/bin/git
[root@liuqin ~]# cd /usr/local/git/bin/
[root@liuqin bin]# ls
git  git-cvsserver  gitk  git-receive-pack  git-shell  git-upload-archive  git-upload-pack
[root@liuqin bin]# rm -rf git *

以上用于删除git的可执行文件

[root@liuqin bin]# which -a git
/usr/bin/which: no git in (/usr/local/git/bin:/usr/lib64/qt-3.3/bin:/usr/local/maven/apache-maven-3.5.0/bin::/usr/java/jdk1.8.0_131/bin::/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
[root@liuqin bin]# vim /etc/bashrc 
[root@liuqin bin]# source /etc/bashrc
image.png

将/etc/bashrc中git的配置注释掉保存并source生效

[root@liuqin bin]# git
-bash: git: command not found
[root@liuqin bin]# vim /etc/bashrc 
[root@liuqin bin]# git --version
-bash: git: command not found

大功告成,以上说明卸载成功!
安装详见老徐的文章http://istester.com/git/118.html

相关文章

  • CentOS7 yum 安装git

    安装git 卸载git

  • git卸载和安装

    1、yum卸载 以上git.x86_64说明已安装 卸载完毕 2、rpm卸载 git-1.8.3.1-20.el7...

  • CentOS7 yum 安装git

    1.查看系统是否已经安装git 2.CentOS7 yum 安装git 3.安装成功 4.卸载git

  • Mac系统下安装卸载Git

    查看Git安装位置 mac上默认安装的git安装在 彻底删除: 安装有其他版本的git卸载方式也一样,进入安装目录...

  • Homebrew命令

    使用brew安装软件 比如安装git:brew install git 使用brew卸载软件 使用brew查询软件...

  • Git安装

    1、查看是否已安装git:git --version 如想安装新版本先卸载:yum remove git (注:用...

  • linux git 卸载和安装

    git 有时一直无法拉取代码,只能重新安装了。 1、为了确保完全卸载可以使用:sudo apt-get remov...

  • linux/Mac配置java开发环境与工具

    Linux openjdk的卸载 JDK8安装 IDEA安装 配合git做版本控制  openjdk的卸载 这有一...

  • homebrew

    Homebrew基本使用 安装任意包 示例:安装node 卸载任意包 示例:卸载git 查询可用包 查看已安装包列...

  • centos7下git安装、卸载及自定义安装

    1. centos7下git安装及卸载 1.1 查看系统是否已经安装git 1.2 CentOS7 yum 安装g...

网友评论

      本文标题:git卸载和安装

      本文链接:https://www.haomeiwen.com/subject/wbkouhtx.html