LoginSignup
36
33

More than 5 years have passed since last update.

最新バージョンGitインストール

Last updated at Posted at 2017-07-31

サーバーの作ったり壊したり作らされたり壊したりをしてるうちにだんだん面倒になったので自分用として最新版gitのインストール方をメモっておく。

Gitインストール

最新のGitのバージョンを確認し、ファイルパスを取得。

ここ→ Gitで現在の最新のバージョンを確認する。

確認したバージョンのファイルパスを取得(マウス右クリックでリンクのアドレスをコピー)
Gitデータ一覧
※下記コードのgit-2.13.3.tar.gzはwiki作成時の最新のもの。

https://www.kernel.org/pub/software/scm/git/git-2.13.3.tar.gz

CentOS7にGitをインストール

Gitの導入に必要なツールを先にインストールする。

$ sudo yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

Gitを導入していきます。まずはソースコードを取得し、解凍する。

$ cd /usr/local/src/
$ sudo wget https://www.kernel.org/pub/software/scm/git/git-2.13.3.tar.gz
$ sudo tar xzvf git-2.13.3.tar.gz

makeコマンドでインストールする。

$ cd git-2.13.3
$ sudo make prefix=/usr/local all
$ sudo make prefix=/usr/local install
$ source /etc/profile

確認する。

$ git --version
git version 2.13.3

気になる場合はtar.gzファイルは削除してしまう。

$ rm -rf git-2.13.3.tar.gz

makeコマンドでエラーが出た場合

昔調べたときにどなたかがエラーの対応コマンドを載せていたのを借用させていただきます。
引用元を見つけたらリンクをはらせていただきます。

/bin/sh: curl-config: command not found

yum install curl-devel

/bin/sh: cc: command not found

yum install gcc

git-compat-util.h:208:25: warning: openssl/ssl.h: No such file or directory g

yum install openssl-devel

http-push.c:14:19: warning: expat.h: No such file or directory

yum install expat-devel

Can't locate ExtUtils/MakeMaker.pm in @INC at Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 3.
make[1]: *** [perl.mak] Error 2
make: *** [perl/perl.mak] Error 2

yum install cpan

MSGFMT po/de.msg make[1]: *** [po/de.msg] Error 127

yum install gettext
36
33
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
36
33