LoginSignup
0
0

More than 3 years have passed since last update.

git更新:Win10・Ubuntu18.04・Ubuntu20.04

Last updated at Posted at 2021-03-30

要点

  1. Debian/Ubuntu を使用する場合、単にapt updateするだけでは最新Verが手に入るとは限らない。

    Ubuntu20.04_bashの場合
     「// 2. 「えっ!ない!」場合:PPAリポ追加。」 を参照

  2. aptitudeがない場合、(便利だから)入れるか。 aptitude versions gitapt list -a git と読み替えて下さい。(多分)一緒

Win10_20H2_PowerShellの場合

  • 2.27.0.windows.1 → v2.31.1.windows.1
// 1. 現在Ver確認
PS C:\Users\***> git --version
  git version 2.27.0.windows.1
// 2. 更新。※`git update-git-for-windows`を使えって怒られるけど、更新できてるので問題ない
PS C:\Users\***> git update
  Git for Windows 2.27.0.windows.1 (64bit)
  Update 2.31.1.windows.1 is available
  Download and install Git for Windows 2.31.1 [N/y]? y
  #################################################################################################### 100.0%-
  #################################################################################################### 100.0%
// 3. Ver確認
PS C:\Users\***> git --version
  git version 2.31.1.windows.1

Ubuntu18.04_bashの場合

  • 2.30.0 → v2.31.1
// 0. 環境表示
WSL_1@DE**:$ cat /etc/lsb-release
  DISTRIB_ID=Ubuntu
  DISTRIB_RELEASE=18.04
  DISTRIB_CODENAME=bionic
  DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"

// 1. 現状確認
WSL_1@DE**:$ git --version
  git version 2.30.0

// 2. aptitudeでVersion確認:gitの最新 v2.31.1 があることを確認
WSL_1@DE**:$ aptitude versions git
  p   1:2.17.0-1ubuntu1                                            bionic                                        500
  p   1:2.17.1-1ubuntu0.8                                          bionic-security,bionic-updates                500
  i   1:2.30.0-0ppa1~ubuntu18.04.1                                                                               100
  p   1:2.31.1-0ppa1~ubuntu18.04.1                                 bionic

// 3. Version選択してインスコする場合:「パッケージ名:希望Ver」 & 「 "" で囲う」
WSL_1@DE**:$ sudo aptitude install "git=1:2.31.1-0ppa1~ubuntu18.04.1"
  以下のパッケージが更新されます:
    git git-man
  2 個のパッケージを更新、 0 個を新たにインストール、 0 個を削除予定、66 個が更新されていない。
  アーカイブの 7,288 kB を取得する必要があります。 展開後に 509 kB のディスク領域が新たに消費されます。
  先に進みますか? [Y/n/?] Y
  取得: 1 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic/main amd64 git amd64 1:2.31.1-0ppa1~ubuntu18.04.1 [5,441 kB]
  取得: 2 http://ppa.launchpad.net/git-core/ppa/ubuntu bionic/main amd64 git-man all 1:2.31.1-0ppa1~ubuntu18.04.1 [1,847 kB]
  7,288 kB を 1分 32秒 秒で取得しました (79.2 kB/s)
  (データベースを読み込んでいます ... 現在 50864 個のファイルとディレクトリがインストールされています。)
  .../git_1%3a2.31.1-0ppa1~ubuntu18.04.1_amd64.deb を展開する準備をしています ...
  git (1:2.31.1-0ppa1~ubuntu18.04.1)(1:2.30.0-0ppa1~ubuntu18.04.1 に) 上書き展開しています ...
  .../git-man_1%3a2.31.1-0ppa1~ubuntu18.04.1_all.deb を展開する準備をしています ...
  git-man (1:2.31.1-0ppa1~ubuntu18.04.1)(1:2.30.0-0ppa1~ubuntu18.04.1 に) 上書き展開しています ...
  git-man (1:2.31.1-0ppa1~ubuntu18.04.1) を設定しています ...
  git (1:2.31.1-0ppa1~ubuntu18.04.1) を設定しています ...
  man-db (2.8.3-2ubuntu0.1) のトリガを処理しています ...

  現在の状態: 66 個 (-2) 更新可能。
// 4. Ver確認
WSL_1@DE**:$ git --version
git version 2.31.1

Ubuntu20.04_bashの場合

  • v2.25.1 → v2.31.1
// 0. 環境表示
WSL_2@DE**:$ cat /etc/lsb-release
  DISTRIB_ID=Ubuntu
  DISTRIB_RELEASE=20.04
  DISTRIB_CODENAME=focal
  DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"

// 1. Ver確認
WSL_2@DE**:$ git --version
  git version 2.25.1
WSL_2@DE**:$ aptitude versions git
  p A 1:2.25.1-1ubuntu3                                        focal                                         500
  i A 1:2.25.1-1ubuntu3.1                                      focal-security,focal-updates                  500

// 2. 「えっ!ない!」場合:PPAリポ追加。※公式方法なので特に問題ない。
WSL_2@DE**:$ sudo add-apt-repository ppa:git-core/ppa
  [sudo] WSL_2 DE**
   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.

  取得:1 http://ppa.launchpad.net/git-core/ppa/ubuntu focal InRelease [23.8 kB]
  ヒット:2 http://archive.ubuntu.com/ubuntu focal InRelease
  取得:3 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
  取得:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
  取得:5 http://ppa.launchpad.net/git-core/ppa/ubuntu focal/main amd64 Packages [3,044 B]
  取得:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
  取得:7 http://ppa.launchpad.net/git-core/ppa/ubuntu focal/main Translation-en [2,252 B]
  353 kB を 2秒 で取得しました (146 kB/s)
  パッケージリストを読み込んでいます... 完了

// 3. aptリスト更新
WSL_2@DE**:$ sudo aptitude update
  発見 http://ppa.launchpad.net/git-core/ppa/ubuntu focal InRelease
  発見 http://archive.ubuntu.com/ubuntu focal InRelease
  発見 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  発見 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  発見 http://security.ubuntu.com/ubuntu focal-security InRelease
// 4. aptitudeでVersion確認:gitの最新 v2.31.1 があることを確認
WSL_2@DE**:$ aptitude versions git
  p A 1:2.25.1-1ubuntu3                                         focal                                         500
  i A 1:2.25.1-1ubuntu3.1                                       focal-security,focal-updates                  500
  p A 1:2.31.1-0ppa1~ubuntu20.04.1                              focal                                         500

// 5. 指定してインスコ。指定しなかった場合、更新されない可能性がある。例:直上の「Ubuntu18.04の場合」
WSL_2@DE**:$ sudo aptitude install "git=1:2.31.1-0ppa1~ubuntu20.04.1"
  以下のパッケージが更新されます:
    git git-man
  更新: 2 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。
  アーカイブの 7,286 kB を取得する必要があります。展開後に 357 kB のディスク領域が解放されます。
  先に進みますか? [Y/n/?] y
  取得: 1 http://ppa.launchpad.net/git-core/ppa/ubuntu focal/main amd64 git amd64 1:2.31.1-0ppa1~ubuntu20.04.1 [5,439 kB]
  取得: 2 http://ppa.launchpad.net/git-core/ppa/ubuntu focal/main amd64 git-man all 1:2.31.1-0ppa1~ubuntu20.04.1 [1,847 kB]
  7,286 kB を 6秒 秒で取得しました (1,212 kB/s)
  (データベースを読み込んでいます ... 現在 41613 個のファイルとディレクトリがインストールされています。)
  .../git_1%3a2.31.1-0ppa1~ubuntu20.04.1_amd64.deb を展開する準備をしています ...
  git (1:2.31.1-0ppa1~ubuntu20.04.1)(1:2.25.1-1ubuntu3.1 に) 上書き展開しています ...
  .../git-man_1%3a2.31.1-0ppa1~ubuntu20.04.1_all.deb を展開する準備をしています ...
  git-man (1:2.31.1-0ppa1~ubuntu20.04.1)(1:2.25.1-1ubuntu3.1 に) 上書き展開しています ...
  git-man (1:2.31.1-0ppa1~ubuntu20.04.1) を設定しています ...
  git (1:2.31.1-0ppa1~ubuntu20.04.1) を設定しています ...
  man-db (2.9.1-1) のトリガを処理しています ...

  現在の状態: 0 個 (-2) 更新可能。

// 6. Ver確認
WSL_2@DE**:$ git --version
  git version 2.31.1

その他

サクッと OpenSSL 更新して脆弱性修正をするつもりだったのに、気がついたら他の更新チェック作業をしてた…

何気なく ssh -V を叩いたら時間が飛んだ

WSL_1@DE**:$ ssh -V 
    OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017

WSL_2@DE**:$ ssh -V 
    OpenSSH_8.2p1 Ubuntu-4ubuntu0.2, OpenSSL 1.1.1f  31 Mar 2020

これはひどい…
やっぱ apt 信用できないなぁ…

でも手動インスコは各所修正が面倒だし、以降のメンテがもっと面倒そう

0
0
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
0