> ## Documentation Index
> Fetch the complete documentation index at: https://bun.zhcndoc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 添加 Git 依赖

Bun 支持直接将 GitHub 仓库添加为项目的依赖。

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun add github:lodash/lodash
```

***

这将会在你的 `package.json` 中添加以下内容：

```json package.json icon="file-json" theme={"theme":{"light":"github-light","dark":"dracula"}}
{
  "dependencies": {
    "lodash": "github:lodash/lodash"
  }
}
```

***

Bun 支持多种协议来指定 Git 依赖。

```sh terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun add git+https://github.com/lodash/lodash.git
bun add git+ssh://github.com/lodash/lodash.git#4.17.21
bun add git@github.com:lodash/lodash.git
bun add github:colinhacks/zod
```

**注意：** GitHub 依赖在可能的情况下会通过 HTTP tarball 下载，以实现更快的安装速度。

***

完整的 Bun 包管理器文档请参见 [文档 > 包管理器](/pm/cli/install)。
