# 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/210a2053c8e007daf9ae39c2a21daaed9b2ddd07d63ecffa597050361e73650c-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
- **パッケージマネージャページ:** <https://formulae.brew.sh/formula/gh>
- **バージョン:** 2.97.0
- **ソース概要:** GitHub command-line tool
- **ホームページ:** <https://cli.github.com/>
- **リポジトリ:** <https://github.com/cli/cli>
- **上流ドキュメント:** <https://cli.github.com/>
- **ライセンス:** MIT
- **ソースアーカイブ:** <https://github.com/cli/cli/archive/refs/tags/v2.97.0.tar.gz>
- **最終更新:** 2026-07-31T05:32:54Z
- **生成日時:** 2026-08-04T22:13:35+00:00

## 実行可能ファイル

- gh (cli)
- gh (エイリアス)

## ビルド依存関係

- go

## インストール挙動

- post-install フック: 未定義
- Bottle: 利用可能 対象 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## バージョンと鮮度

- ページ生成日: 2026-08-04
- マネージャ版: 2.97.0
- マネージャ更新日: 2026-07-31
- ローカルデータ: OK
- 上流リポジトリ: https://github.com/cli/cli
- 検出された最新: v2.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
## ソースデータベース詳細

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** gh
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

## 他のパッケージマネージャ記録

- 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/210a2053c8e007daf9ae39c2a21daaed9b2ddd07d63ecffa597050361e73650c-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


## 関連リンク

- [Source-control packages](https://pkg.so/ja/source-control-tools/) - Belongs to a source-control command family.
- [Secret-risk packages](https://pkg.so/ja/secret-risk-packages/) - Has protected-tool coverage, approval-gate, or non-low Geiger security signals.
- [Terminal utility packages](https://pkg.so/ja/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://pkg.so/ja/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [go](https://pkg.so/ja/brew/go/) - Build dependency declared by Homebrew.
- [sugarjar](https://pkg.so/ja/brew/sugarjar/) - Popular package that depends on this formula.
- [git-xargs](https://pkg.so/ja/brew/git-xargs/) - Shares pkgdb curated category or tags: automation, cli, developer-tools, git, github.
- [watchman](https://pkg.so/ja/brew/watchman/) - Shares pkgdb curated category or tags: automation, cli, developer-tools.
- [lazygit](https://pkg.so/ja/brew/lazygit/) - Shares pkgdb curated category or tags: cli, developer-tools, git.
- [ansible-lint](https://pkg.so/ja/brew/ansible-lint/) - Shares pkgdb curated category or tags: automation, cli, developer-tools.
- [lefthook](https://pkg.so/ja/brew/lefthook/) - Shares pkgdb curated category or tags: automation, cli, developer-tools, git.
- [watchexec](https://pkg.so/ja/brew/watchexec/) - Shares pkgdb curated category or tags: automation, cli, developer-tools.
- [hub](https://pkg.so/ja/brew/hub/) - Shares pkgdb curated category or tags: cli, developer-tools, git, github.
- [git-spice](https://pkg.so/ja/brew/git-spice/) - Shares pkgdb curated category or tags: cli, developer-tools, git, github.
- [git-cal](https://pkg.so/ja/brew/git-cal/) - Local package facts share a topical domain. Shared terms: cli, command-line, developer, developer-tools, git.

## 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
- package-page enrichment
- curated configuration and credential file locations
- curated package history
- package version freshness
- pkgdb category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
- curated agent safety answer
