Cargo supports some forms of authentication when using git dependencies and registries. This appendix contains some information for setting up git authentication in a way that works with Cargo.
If you need other authentication methods, the
config value can be set to cause Cargo to execute the
git executable to
handle fetching remote repositories instead of using the built-in support.
This can be enabled with the
HTTPS authentication requires the
credential.helper mechanism. There are
multiple credential helpers, and you specify the one you want to use in your
global git configuration file.
# ~/.gitconfig [credential] helper = store
Cargo does not ask for passwords, so for most helpers you will need to give
the helper the initial username/password before running Cargo. One way to do
this is to run
git clone of the private git repo and enter the
macOS users may want to consider using the osxkeychain helper.
Windows users may want to consider using the GCM helper.
Note: Windows users will need to make sure that the
shshell is available in your
PATH. This typically is available with the Git for Windows installation.
SSH authentication requires
ssh-agent to be running to acquire the SSH key.
Make sure the appropriate environment variables are set up (
most Unix-like systems), and that the correct keys are added (with
Windows uses Pageant for SSH authentication.
Note: Cargo does not support git's shorthand SSH URLs like
email@example.com/user/repo.git. Use a full SSH URL like
Note: SSH configuration files (like OpenSSH's
~/.ssh/config) are not used by Cargo's built-in SSH library. More advanced requirements should use