# 使用 Homebrew, apk, chocolatey, apt, MacPorts, Nix, pacman, zypper, scoop, winget 安装 hub

查看 hub 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:hub
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install hub
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install hub
```

  证据: MacPorts ports tree: devel/hub/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add hub
```

  证据: Alpine Linux edge package indexes: hub from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install hub
```

  证据: Debian stable package indexes: hub from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- Nix (92%):

```sh
nix profile install nixpkgs#hub
```

  证据: nixpkgs package indexes: pkgs/by-name/hu/hub/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S hub
```

  证据: Arch Linux sync databases: hub from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install hub
```

  证据: openSUSE Tumbleweed package metadata: hub from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Chocolatey (92%):

```sh
choco install hub
```

  证据: Chocolatey community package catalog: hub from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','handbrake.install'

- Scoop (92%):

```sh
scoop install main/hub
```

  证据: Scoop official bucket manifest trees: bucket/hub.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

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

  证据: Windows Package Manager source index: GitHub.hub from https://cdn.winget.microsoft.com/cache/source.msix

## 软件包事实

- **软件包键:** brew:hub
- **软件包管理器:** Homebrew
- **版本:** 2.14.2
- **来源摘要:** Add GitHub support to git on the command-line
- **主页:** <https://hub.github.com/>
- **仓库:** <https://github.com/mislav/hub>
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- hub (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 2.14.2
## 项目历史与用法

hub is a GitHub-oriented command-line companion for Git. Its central idea is deliberately conservative: keep normal Git behavior, then add shorthand and subcommands for common GitHub work such as cloning owner/repository names, opening project pages, creating repositories, managing issues, pull requests, releases, and making GitHub API calls from scripts.

### 项目历史

The public GitHub repository was created in December 2009 under Mislav Marohnić's account, and the project later lived at the canonical github/hub repository while retaining the mislav/hub URL as an official repository redirect. The documentation describes hub as an extension to command-line Git, and its manual groups commands into Git commands that hub extends and GitHub-specific commands that hub adds.

hub occupied an important pre-gh niche: it made GitHub feel native inside a Git workflow before GitHub's separately branded gh CLI became the official general-purpose GitHub CLI. The hub README acknowledges gh as GitHub's more user-facing CLI while preserving hub's role as a lightweight Git wrapper and scripting tool.

### 采用历史

hub spread through developer package managers because it matched an everyday GitHub workflow rather than a narrow build-time need. The Homebrew formula metadata for this batch lists packages across Homebrew, Debian, Ubuntu, Arch, Fedora, openSUSE, MacPorts, Nix, Scoop, Chocolatey, winget, and other ecosystems, while the project README documents similarly broad install paths.

### 使用方式

Typical use is interactive and scriptable: users alias hub as git, clone repositories by GitHub shorthand, fork or create repositories, open pull requests, inspect issues, publish releases, or drop to `hub api` for raw GitHub REST or GraphQL calls. Configuration and OAuth credentials are stored under the XDG-style hub configuration path unless a token is supplied through the environment.

### 为什么软件包爱好者会关心

For package nerds, hub is a classic example of a small CLI that became distribution-worthy by wrapping an existing universal tool instead of replacing it. It also records a period in GitHub tooling history when third-party and community-maintained command-line clients filled gaps that later became first-party platform features.

### 时间线

- 2009: Public GitHub repository created for hub.
- 2014: GitHub Releases metadata records hub 1.12.x releases.
- 2020: hub 2.14.2 release published with manual pages identifying version 2.14.2.
- 2020s: README directs users who want GitHub's official general-purpose CLI toward gh while continuing to document hub's Git-wrapper workflow.

### Related projects

- Related projects include Git itself, GitHub's gh CLI, GitHub Enterprise, Gist, GitHub Actions, and the GitHub REST and GraphQL APIs exposed through `hub api`.

### 来源

- Official hub site, hub manual, repository README, GitHub repository metadata, GitHub Releases API, and Homebrew package metadata supplied in the batch input.


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals


## 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/hub, ~/.config/hub

## Credential files

- Unix: $XDG_CONFIG_HOME/hub, ~/.config/hub
## 其他软件包管理器记录

- Debian apt - hub - 2.14.2~ds1-1+b23: normalized package name match | Debian stable package indexes: hub from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | make git easier with GitHub | https://github.com/github/hub
- Nix - hub: normalized package name match | nixpkgs package indexes: pkgs/by-name/hu/hub/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - hub - 2.14.2~ds1-1ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: hub from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | make git easier with GitHub | https://github.com/github/hub
- apk - hub - 2.14.2-r42: normalized package name match | Alpine Linux edge package indexes: hub from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | Extends git with extra features for GitHub | https://hub.github.com/
- apk - hub-bash-completion - 2.14.2-r42: normalized package name match | Alpine Linux edge package indexes: hub-bash-completion from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | Bash completions for hub | https://hub.github.com/
- apk - hub-doc - 2.14.2-r42: normalized package name match | Alpine Linux edge package indexes: hub-doc from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | Extends git with extra features for GitHub (documentation) | https://hub.github.com/
- apk - hub-fish-completion - 2.14.2-r42: normalized package name match | Alpine Linux edge package indexes: hub-fish-completion from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | Fish completions for hub | https://hub.github.com/
- apk - hub-zsh-completion - 2.14.2-r42: normalized package name match | Alpine Linux edge package indexes: hub-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz | Zsh completions for hub | https://hub.github.com/
- pacman - hub - 2.14.2-4: normalized package name match | Arch Linux sync databases: hub from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | cli interface for Github | https://hub.github.com
- zypper - hub - 2.14.2-2.12: normalized package name match | openSUSE Tumbleweed package metadata: hub from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Command-line wrapper for git and GitHub | https://github.com/github/hub
- MacPorts - hub: normalized package name match | MacPorts ports tree: devel/hub/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Chocolatey - hub: normalized package name match | Chocolatey community package catalog: hub from http://community.chocolatey.org/api/v2/Packages?$filter=IsLatestVersion&$select=Id&$top=1000&$skiptoken='11','handbrake.install'
- Scoop - main/hub: normalized package name match | Scoop official bucket manifest trees: bucket/hub.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - GitHub.hub: normalized package name match | Windows Package Manager source index: GitHub.hub from https://cdn.winget.microsoft.com/cache/source.msix


## Combined YAML source

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


## 来源

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