41 lines
816 B
Plaintext
41 lines
816 B
Plaintext
---
|
|
title: Add a Git dependency
|
|
sidebarTitle: Add a Git dependency
|
|
mode: center
|
|
---
|
|
|
|
Bun supports directly adding GitHub repositories as dependencies of your project.
|
|
|
|
```sh terminal icon="terminal"
|
|
bun add github:lodash/lodash
|
|
```
|
|
|
|
---
|
|
|
|
This adds the following line to your `package.json`:
|
|
|
|
```json package.json icon="file-json"
|
|
{
|
|
"dependencies": {
|
|
"lodash": "github:lodash/lodash"
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
Bun supports several protocols for specifying Git dependencies.
|
|
|
|
```sh terminal icon="terminal"
|
|
bun add git+https://github.com/lodash/lodash.git
|
|
bun add git+ssh://github.com/lodash/lodash.git#4.17.21
|
|
bun add [email protected]:lodash/lodash.git
|
|
bun add github:lodash/lodash#4.17.21
|
|
```
|
|
|
|
When possible, Bun downloads GitHub dependencies as HTTP tarballs, which is faster.
|
|
|
|
---
|
|
|
|
See [`bun install`](/pm/cli/install).
|