# gh を Homebrew, chocolatey, apt, dnf, MacPorts, Nix, zypper, scoop, winget でインストール

gh のインストール経路、実行ファイル、メタデータ、AI エージェント向けセキュリティノートを確認します。

## インストール

```sh
sudo av install brew:gh
```

## エージェント安全性の回答

gh is the GitHub control-plane CLI for repositories, releases, issues, and authenticated developer state.

- **認証情報アクセス:** Reads GitHub CLI tokens and can print or use them for API calls.
- **リモート変更:** Can modify repositories, pull requests, releases, secrets, and organization state.
- **公開/成果物リスク:** Can create releases, upload assets, and trigger release automation.
- **推奨コントロール:** Use GitHub token protection plus approval gates for write and token-display commands.
- **エージェント利用ガイダンス:** Permit status and read-only queries; require approval for token output, release creation, repo writes, and workflow dispatch.

追加のインストールコマンド:

### macOS

- Homebrew (100%):

```sh
brew install gh
```

  証拠: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install gh
```

  証拠: MacPorts ports tree: devel/gh/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- Debian apt (92%):

```sh
sudo apt install gh
```

  証拠: Debian stable package indexes: gh from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install gh
```

  証拠: Fedora Rawhide package metadata: gh from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#gh
```

  証拠: nixpkgs package indexes: pkgs/by-name/gh/gh/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- zypper (92%):

```sh
sudo zypper install gh
```

  証拠: openSUSE Tumbleweed package metadata: gh from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Chocolatey (92%):

```sh
choco install gh
```

  証拠: Chocolatey community package catalog: gh from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','fusioninventory-agent'

- Scoop (92%):

```sh
scoop install main/gh
```

  証拠: Scoop official bucket manifest trees: bucket/gh.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id GitHub.cli -e
```

  証拠: Windows Package Manager source index: GitHub.cli from https://cdn.winget.microsoft.com/cache/source.msix

## パッケージ情報

- **パッケージキー:** brew:gh
- **パッケージマネージャ:** Homebrew
- **バージョン:** 2.97.0
- **ソース概要:** GitHub command-line tool
- **ホームページ:** <https://cli.github.com/>
- **リポジトリ:** <https://github.com/cli/cli>
- **最終更新:** 2026-07-31T05:32:54Z
- **生成日時:** 2026-08-03T19:37:03+00:00

## 実行可能ファイル

- gh (エイリアス)

## インストール挙動

- Bottle: 利用不可

## バージョンと鮮度

- ページ生成日: 2026-08-03
- マネージャ版: 2.97.0
## プロジェクトの歴史と使われ方

GitHub CLI, invoked as `gh`, is GitHub's official command-line tool for working with pull requests, issues, repositories, releases, Actions, authentication, and GitHub API data from a terminal.

### プロジェクトの歴史

GitHub created the cli/cli repository in October 2019 and opened the project as a new official CLI distinct from the older community `hub` tool. GitHub announced the beta in February 2020 and released GitHub CLI 1.0 in September 2020.

The README frames `gh` as a standalone tool that brings GitHub concepts next to `git` and source code work. The project grew into a cross-platform Go CLI with first-party manuals, release binaries, package repositories, GitHub Enterprise support, extension support, API helpers, and later supply-chain features such as build provenance attestations for release artifacts.

### 採用の歴史

GitHub CLI has broad adoption because it is distributed through GitHub's own package repositories and release binaries, package managers such as Homebrew and WinGet, and GitHub-hosted Actions runner images. Its first-party status made it a standard automation interface for GitHub workflows in shells and CI jobs.

### 使われ方

Practitioners use `gh` to create and review pull requests, triage issues, clone and browse repositories, trigger or inspect Actions workflows, manage releases and gists, authenticate to GitHub hosts, call the GitHub API, and script repository operations without leaving the command line.

### パッケージ好きにとっての重要性

For package and automation ecosystems, `gh` is important because it gives GitHub an official, versioned executable surface. Package maintainers can depend on consistent commands across macOS, Linux, and Windows, while CI authors can use a preinstalled or easily installed binary instead of hand-rolling API calls.

### タイムライン

- 2019: The cli/cli repository was created.
- 2020: GitHub announced GitHub CLI beta.
- 2020: GitHub CLI 1.0.0 was published.
- 2024: The README records release build provenance attestations beginning with version 2.50.0.

### Related projects

- The README compares GitHub CLI with `hub`, noting that `hub` behaves as a proxy to `git` while `gh` is a standalone tool for GitHub workflows.

### ソース

- <https://api.github.com/repos/cli/cli>
- <https://api.github.com/repos/cli/cli/releases>
- <https://cli.github.com/manual/gh>
- <https://docs.github.com/en/github-cli/github-cli/about-github-cli>
- <https://formulae.brew.sh/formula/gh>
- <https://github.blog/2020-02-12-supercharge-your-command-line-experience-github-cli-is-now-in-beta/>
- <https://github.blog/2020-09-17-github-cli-1-0-is-now-available/>
- <https://github.com/cli/cli>
- <https://raw.githubusercontent.com/cli/cli/trunk/README.md>


## セキュリティノート

broad networked developer tool.

- **Geiger リスク:** blue / 高
- broad networked developer tool
- **承認ゲートルール:** 7


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: $XDG_CONFIG_HOME/gh/config.yml, ~/.config/gh/config.yml
- Windows: %AppData%\GitHub CLI\config.yml

## Credential files

- Unix: $XDG_CONFIG_HOME/gh/hosts.yml, ~/.config/gh/hosts.yml
- Windows: %AppData%\GitHub CLI\hosts.yml
## 他のパッケージマネージャ記録

- Debian apt - gh - 2.46.0-3: normalized package name match | Debian stable package indexes: gh from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | GitHub CLI, GitHub’s official command line tool | https://cli.github.com/
- Nix - gh: normalized package name match | nixpkgs package indexes: pkgs/by-name/gh/gh/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - gh - 2.45.0-1build1: normalized package name match | Ubuntu 24.04 LTS package indexes: gh from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | GitHub CLI, GitHub’s official command line tool | https://cli.github.com/
- dnf - gh - 2.97.0-1.fc45: normalized package name match | Fedora Rawhide package metadata: gh from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | GitHub's official command line tool | https://github.com/cli/cli
- zypper - gh - 2.96.0-2.2: normalized package name match | openSUSE Tumbleweed package metadata: gh from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | The official CLI for GitHub | https://cli.github.com/
- zypper - gh-bash-completion - 2.96.0-2.2: normalized package name match | openSUSE Tumbleweed package metadata: gh-bash-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Bash Completion for gh | https://cli.github.com/
- zypper - gh-fish-completion - 2.96.0-2.2: normalized package name match | openSUSE Tumbleweed package metadata: gh-fish-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Fish completion for gh | https://cli.github.com/
- zypper - gh-zsh-completion - 2.96.0-2.2: normalized package name match | openSUSE Tumbleweed package metadata: gh-zsh-completion from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | ZSH Completion for gh | https://cli.github.com/
- MacPorts - gh: normalized package name match | MacPorts ports tree: devel/gh/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Chocolatey - gh: normalized package name match | Chocolatey community package catalog: gh from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','fusioninventory-agent'
- Scoop - main/gh: normalized package name match | Scoop official bucket manifest trees: bucket/gh.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - GitHub.cli: normalized package name match | Windows Package Manager source index: GitHub.cli from https://cdn.winget.microsoft.com/cache/source.msix


## Combined YAML source

View the package source record on GitHub. [combined/gh.yml](https://github.com/mxcl/pkgdb/blob/main/combined/gh.yml)


## ソース

- pkg.so package database
- Geiger risk classifier
- approval-gate seed metadata
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
- curated agent safety answer
