LoginSignup
0
1

More than 5 years have passed since last update.

GITがアンインストールできない場合

Last updated at Posted at 2017-10-15

GIT2.7.0のhooksがなぜか使えないので
アンインストールしようとしたらできなかった。

まず、適当なディレクトリを作成し、そこにGitをインストールする。

$ mkdir /tmp/test_git
$ cd /usr/local/src/git-2.3.1/
$ make prefix=/tmp/test_git install

次に、インストールされたファイルをリストとして出力する。

$ find /tmp/test_git -type f -print > /tmp/git-installlist.txt

そして、出力されたファイルの全行の /tmp/test_git を /usr/local (元のインストールディレクトリ)に置換する。

$ vim /tmp/git-installlist.txt


:%s/\/tmp\/test_git/\/usr\/local/g

置換した結果
```
$ git-installliset.txt

/tmp/test_git/libexec/git-core/git-send-pack
/tmp/test_git/libexec/git-core/git-am
/tmp/test_git/libexec/git-core/git
(後略)

↓↓↓
$ git-installliset.txt

/usr/local/libexec/git-core/git-send-pack
/usr/local/libexec/git-core/git-am
/usr/local/libexec/git-core/git
(後略)

最後に、| xargsでgit-installlist.txtの内容をrmに渡してファイルを消す。

$ cat /tmp/git-installlist.txt | xargs rm -f
```
ここでアンインストール終了

そのあと普通のGITをインストール

$ yum install git

-bash: /usr/local/bin/git: そのようなファイルやディレクトリはありません
が出てくる

$ which git
/usr/bin/git

シンボリックリンクをつなげる

$ ln -s /usr/bin/git /usr/local/bin/git
$ git --version

git version 1.7.1

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1