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

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

## 安装

```sh
sudo av install brew:git
```

## 代理安全回答

git can read repository history and mutate source-control state used by agents and humans.

- **凭据访问:** Reads credential helpers, remotes, config, signed keys, and repository-local secret history.
- **远程变更:** Can push commits, tags, branches, and force updates to remote repositories.
- **发布/制品风险:** Can publish source changes and release tags that downstream systems consume.
- **推荐控制:** Gate pushes, tag creation, credential fill, and remote rewrites.
- **代理使用指南:** Allow diff/status/log reads; require approval for pushes, credential-helper reads, and destructive history changes.

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install git
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install git
```

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

### Linux

- apk (92%):

```sh
sudo apk add git
```

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

- Debian apt (92%):

```sh
sudo apt install git
```

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

- dnf (92%):

```sh
sudo dnf install git
```

  证据: Fedora Rawhide package metadata: git 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#git
```

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

- pacman (92%):

```sh
sudo pacman -S git
```

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

- zypper (92%):

```sh
sudo zypper install git
```

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

### Windows

- Chocolatey (92%):

```sh
choco install git
```

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

- Scoop (92%):

```sh
scoop install main/git
```

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

- winget (92%):

```sh
winget install --id DuckStudio.ChineseGit -e
```

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

## 软件包事实

- **软件包键:** brew:git
- **软件包管理器:** Homebrew
- **版本:** 2.55.0
- **来源摘要:** Distributed revision control system
- **主页:** <https://git-scm.com>
- **仓库:** <https://github.com/git/git>
- **最后更新:** 2026-06-29T20:54:53Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- git (别名)
- git-cvsserver (别名)
- git-receive-pack (别名)
- git-shell (别名)
- git-upload-archive (别名)
- git-upload-pack (别名)
- scalar (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

Git is the distributed version-control system created for Linux kernel development and later generalized into the default source-control substrate for much of software development. Its command-line interface, repository format, protocol family, and ecosystem of hosting services define how many projects exchange code.

### 项目历史

Git began in 2005 after the Linux kernel community lost access to the proprietary BitKeeper workflow it had been using. Linus Torvalds wrote the original implementation to support Linux-scale development, emphasizing speed, integrity, distributed operation, and cheap branching.

The design departed from centralized version-control systems by making every clone a full repository with local history and branch operations. That choice made offline work, fork-based development, and patch exchange natural rather than exceptional.

After its Linux origin, Git evolved into a broadly portable tool with a large manual set, porcelain commands for everyday work, and plumbing commands for scripts and higher-level tools. The kernel.org repository remains the canonical upstream source location, while git-scm.com provides the public documentation hub.

### 采用历史

Git's adoption accelerated with distributed open source development and the rise of Git hosting services such as GitHub, GitLab, and related forges. The official Git site characterizes the core project as a command-line tool surrounded by hosting services, graphical clients, editor integrations, and other command-line helpers.

By the early 2010s, Git had moved from a Linux-kernel tool into the common denominator for open source collaboration, commercial software teams, CI systems, package ecosystems, and code review platforms. Its repository model also became the foundation for workflows outside source code, including documentation and data-adjacent projects.

### 使用方式

Practitioners use Git to initialize or clone repositories, stage and commit changes, branch and merge work, inspect history, exchange commits through remotes, and recover earlier states. Its local-first model makes common commands fast because most history and metadata are on the developer's machine.

Teams layer policy on top of Git through protected branches, pull requests, signed commits, release tags, submodules, worktrees, hooks, and CI triggers. The same executable serves both interactive daily work and automation in release scripts, package recipes, deployment systems, and source archives.

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

Git is one of the central dependencies of package-manager culture. Formulae, ports, distro source packages, language registries, and build systems routinely fetch from Git repositories, pin commits or tags, generate source archives, and use Git metadata to derive versions.

Its significance also comes from its stability as an interchange format. Even tools that wrap Git, avoid the Git CLI, or store files elsewhere usually need to speak in Git concepts: commits, refs, remotes, branches, tags, diffs, and patches.

### 时间线

- 2005: Git was created for Linux kernel development after the BitKeeper transition.
- 2005: Early Git releases established the distributed repository model.
- 2010s: Hosted Git forges and pull-request workflows made Git the dominant version-control system for many developer communities.
- 2020s: Git remained a base dependency for package managers, CI, source archives, and developer tools.

### Related projects

- Linux kernel development drove Git's original requirements.
- GitHub, GitLab, Gitea, Forgejo, and other forges build hosted collaboration around Git repositories.
- Git LFS and Git Xet extend Git workflows for large-file storage.
- Scalar, included with Git packages, targets very large repository workflows.

### 来源

- <https://git-scm.com/about>
- <https://git-scm.com/book/en/v2/Getting-Started-A-Short-History-of-Git>
- <https://git-scm.com/docs>
- <https://git-scm.com/docs/git>
- <https://git.kernel.org/pub/scm/git/git.git>


## 安全说明

doc example: broad file and network tool.

- **Geiger 风险:** blue / 高
- doc example: broad file and network tool
- **审批门规则:** 6


## 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.


## Credential files

- Unix: ~/.git-credentials
## 其他软件包管理器记录

- Debian apt - git - 1:2.47.3-0+deb13u1: normalized package name match | Debian stable package indexes: git from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | fast, scalable, distributed revision control system | https://git-scm.com/
- Debian apt - git-all - 1:2.47.3-0+deb13u1: normalized package name match | Debian stable package indexes: git-all from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | fast, scalable, distributed revision control system (all subpackages) | https://git-scm.com/
- Debian apt - git-cvs - 1:2.47.3-0+deb13u1: normalized package name match | Debian stable package indexes: git-cvs from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | fast, scalable, distributed revision control system (cvs interoperability) | https://git-scm.com/
- Debian apt - git-doc - 1:2.47.3-0+deb13u1: normalized package name match | Debian stable package indexes: git-doc from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | fast, scalable, distributed revision control system (documentation) | https://git-scm.com/
- Debian apt - git-email - 1:2.47.3-0+deb13u1: normalized package name match | Debian stable package indexes: git-email from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | fast, scalable, distributed revision control system (email add-on) | https://git-scm.com/
- Debian apt - git-gui - 1:2.47.3-0+deb13u1: normalized package name match | Debian stable package indexes: git-gui from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | fast, scalable, distributed revision control system (GUI) | https://git-scm.com/
- Debian apt - git-man - 1:2.47.3-0+deb13u1: normalized package name match | Debian stable package indexes: git-man from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | fast, scalable, distributed revision control system (manual pages) | https://git-scm.com/
- Debian apt - git-mediawiki - 1:2.47.3-0+deb13u1: normalized package name match | Debian stable package indexes: git-mediawiki from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | fast, scalable, distributed revision control system (MediaWiki remote helper) | https://git-scm.com/
- Debian apt - git-svn - 1:2.47.3-0+deb13u1: normalized package name match | Debian stable package indexes: git-svn from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | fast, scalable, distributed revision control system (svn interoperability) | https://git-scm.com/
- Debian apt - gitk - 1:2.47.3-0+deb13u1: normalized package name match | Debian stable package indexes: gitk from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | fast, scalable, distributed revision control system (revision tree visualizer) | https://git-scm.com/
- Debian apt - gitweb - 1:2.47.3-0+deb13u1: normalized package name match | Debian stable package indexes: gitweb from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | fast, scalable, distributed revision control system (web interface) | https://git-scm.com/
- Nix - git: normalized package name match | nixpkgs package indexes: pkgs/by-name/gi/git/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - git - 1:2.43.0-1ubuntu7: normalized package name match | Ubuntu 24.04 LTS package indexes: git from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | fast, scalable, distributed revision control system | https://git-scm.com/
- Ubuntu apt - git-all - 1:2.43.0-1ubuntu7: normalized package name match | Ubuntu 24.04 LTS package indexes: git-all from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | fast, scalable, distributed revision control system (all subpackages) | https://git-scm.com/
- Ubuntu apt - git-cvs - 1:2.43.0-1ubuntu7: normalized package name match | Ubuntu 24.04 LTS package indexes: git-cvs from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | fast, scalable, distributed revision control system (cvs interoperability) | https://git-scm.com/
- Ubuntu apt - git-daemon-run - 1:2.43.0-1ubuntu7: normalized package name match | Ubuntu 24.04 LTS package indexes: git-daemon-run from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | fast, scalable, distributed revision control system (git-daemon service) | https://git-scm.com/


## Combined YAML source

View the package source record on GitHub. [combined/git.yml](https://github.com/mxcl/pkgdb/blob/main/combined/git.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
