Git をアップデートした

Posted on 2020-04-19 in zakki

Git をアップデートします。

( 参考 ) NVD - CVE-2020-5260

環境

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"

$ git --version
git version 2.17.1

手順

非公式レポジトリを追加してインストールします。

このレポジトリにも導入方法が書いてありますが、一応メモ。

add-apt-repositoryでレポジトリを追加する。

$ sudo add-apt-repository ppa:git-core/ppa
 The most current stable version of Git for Ubuntu.

For release candidates, go to https://launchpad.net/~git-core/+archive/candidate .
 More info: https://launchpad.net/~git-core/+archive/ubuntu/ppa
Press [ENTER] to continue or Ctrl-c to cancel adding it.

Hit:1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
Get:5 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease [20.7 kB]
Get:6 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic/main amd64 Packages [3,036 B]
Get:7 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic/main Translation-en [2,252 B]

apt updateでパッケージ情報の最新化。

$ sudo apt update
Hit:1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:5 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic InRelease
Reading package lists... Done

apt install gitのインストール。

$ sudo apt install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  git-man libpcre2-8-0
Suggested packages:
  git-daemon-run | git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn
The following NEW packages will be installed:
  libpcre2-8-0
The following packages will be upgraded:
  git git-man
2 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 8,369 kB of archives.
After this operation, 11.6 MB of additional disk space will be used.
Do you want to continue? [Y/n]

結果

$ git --version
git version 2.26.1

よかった。

Ubuntu Git