Skip to content

Commit

Permalink
Provide alternative to SSH for accessing private repo dependencies (#…
Browse files Browse the repository at this point in the history
…6245)

Fixes #6234 

---------

Co-authored-by: Parker Lougheed <[email protected]>
  • Loading branch information
MaryaBelanger and parlough authored Dec 3, 2024
1 parent f70f55a commit 557aca9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/content/tools/pub/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,21 @@ dependencies:
The `git` here says this package is found using Git, and the URL after that is
the Git URL that can be used to clone the package.

Even if the package repo is private, if you can
[connect to the repo using SSH,][GitHub SSH]
then you can depend on the package by using the repo's SSH URL:
Even if the package repo is private,
you can configure your `git` setup to access the repo using an
[HTTPS access key][GitHub HTTPS] or an [SSH key-pair][GitHub SSH].
Then you can depend on the package by using the repo's corresponding URL:

```yaml
dependencies:
kittens:
# SSH URL:
git: [email protected]:munificent/kittens.git
```

The `dart pub` command calls `git clone` as a subprocess, so all you need to
provide is a `<url>` that works when `git clone <url>` is executed.

If you want to depend on a specific commit, branch, or tag,
add a `ref` key to the description:

Expand Down Expand Up @@ -557,6 +562,7 @@ to differentiate versions. <a href="#fnref:semver">↩</a>

</aside>

[GitHub HTTPS]: https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git
[GitHub SSH]: https://help.github.com/articles/connecting-to-github-with-ssh/
[pub package manager]: /tools/pub/packages
[`dart pub get`]: /tools/pub/cmd/pub-get
Expand Down

0 comments on commit 557aca9

Please sign in to comment.