Skip to content

Instantly share code, notes, and snippets.

@cs50victor
Forked from kestein/Private_Crates.md
Created September 7, 2024 17:59
Show Gist options
  • Select an option

  • Save cs50victor/26e8be7b46dd7f6d13a6066bd391a041 to your computer and use it in GitHub Desktop.

Select an option

Save cs50victor/26e8be7b46dd7f6d13a6066bd391a041 to your computer and use it in GitHub Desktop.
Linking to a private repo in Cargo.toml

Under the dependencies section, put

<crate name>={git="ssh://git@github.com/<organization>/<reponame>.git"}

It is pretty similar to a github repo's ssh cloning link, however the : is replaced with a / and ssh:// is prepended to the URL.

git@github.com:my-organization/my-repo.git vs ssh://git@github.com/my-organization/my-repo.git

The SSH URL needs to be used because Cargo is currently unable to handle the authentication prompt that comes up when an HTTPS link is used.
Make sure that the matches the crate name in the target repo's Cargo.toml. The repo name will not override what is in the Cargo.toml if it is a different value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment