0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Github CLIをインストールしてみた(WSL)

Posted at

この記事のゴール

  • gh コマンドが実行できること

実行環境

  • WSL(Ubuntu)

参考

手順

zzzzzz@xxxxxxxxxx:~$ (type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
        && sudo mkdir -p -m 755 /etc/apt/keyrings \
        && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
        && cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
        && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
        && sudo mkdir -p -m 755 /etc/apt/sources.list.d \
        && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
        && sudo apt update \
        && sudo apt install gh -y
[sudo] password for zzzzzz:
2025-08-11 23:40:54 URL:https://cli.github.com/packages/githubcli-archive-keyring.gpg [2270/2270] -> "/tmp/tmp.ZZpYNbxL1d" [1]
Get:1 https://cli.github.com/packages stable InRelease [3917 B]
Get:2 https://cli.github.com/packages stable/main amd64 Packages [346 B]
Get:3 https://download.docker.com/linux/ubuntu jammy InRelease [48.8 kB]
Get:4 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages [54.4 kB]
Get:5 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Hit:6 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:7 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Get:8 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [2557 kB]
Get:9 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]
Get:10 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [2802 kB]
Get:11 http://security.ubuntu.com/ubuntu jammy-security/main Translation-en [379 kB]
Get:12 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [4013 kB]
Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/main Translation-en [443 kB]
Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [4157 kB]
Get:15 http://security.ubuntu.com/ubuntu jammy-security/restricted Translation-en [729 kB]
Get:16 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [993 kB]
Get:17 http://security.ubuntu.com/ubuntu jammy-security/universe Translation-en [217 kB]
Get:18 http://archive.ubuntu.com/ubuntu jammy-updates/restricted Translation-en [753 kB]
Get:19 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1226 kB]
Get:20 http://archive.ubuntu.com/ubuntu jammy-updates/universe Translation-en [304 kB]
Get:21 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [59.5 kB]
Get:22 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse Translation-en [14.2 kB]
Get:23 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [68.8 kB]
Get:24 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [30.0 kB]
Fetched 19.2 MB in 3s (5669 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
49 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  htop libcommon-sense-perl libjson-perl libjson-xs-perl libllvm13 libpq5 libtypes-serialiser-perl
  libvulkan1 mesa-vulkan-drivers ssl-cert sysstat
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  gh
0 upgraded, 1 newly installed, 0 to remove and 49 not upgraded.
Need to get 18.7 MB of archives.
After this operation, 54.8 MB of additional disk space will be used.
Get:1 https://cli.github.com/packages stable/main amd64 gh amd64 2.76.2 [18.7 MB]
Fetched 18.7 MB in 2s (11.0 MB/s)
Selecting previously unselected package gh.
(Reading database ... 70428 files and directories currently installed.)
Preparing to unpack .../archives/gh_2.76.2_amd64.deb ...
Unpacking gh (2.76.2) ...
Setting up gh (2.76.2) ...
Processing triggers for man-db (2.10.2-1) ...
zzzzzz@xxxxxxxxxx:~$ sudo apt update
Hit:1 https://cli.github.com/packages stable InRelease
Hit:2 https://download.docker.com/linux/ubuntu jammy InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
Get:5 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Hit:6 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:7 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [2803 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy-updates/main Translation-en [443 kB]
Get:9 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [4163 kB]
Get:10 http://archive.ubuntu.com/ubuntu jammy-updates/restricted Translation-en [756 kB]
Fetched 8293 kB in 3s (3160 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
49 packages can be upgraded. Run 'apt list --upgradable' to see them.
zzzzzz@xxxxxxxxxx:~$ sudo apt install gh
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gh is already the newest version (2.76.2).
The following packages were automatically installed and are no longer required:
  htop libcommon-sense-perl libjson-perl libjson-xs-perl libllvm13 libpq5 libtypes-serialiser-perl
  libvulkan1 mesa-vulkan-drivers ssl-cert sysstat
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 49 not upgraded.
zzzzzz@xxxxxxxxxx:~$ which gh
/usr/bin/gh
zzzzzz@xxxxxxxxxx:~$ gh version
gh version 2.76.2 (2025-07-30)
https://github.com/cli/cli/releases/tag/v2.76.2
zzzzzz@xxxxxxxxxx:~$

秒速でインストール完了しました。。。

以上

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?