So, we have managed so set up a custom registry for our internal needs.
.cargo/config.toml looks like this:
[net]
git-fetch-with-cli=true
[registries]
ours = { index = "https://git.my-custom-registry.de/rust-registry/index.git" }
If I run a cargo buildmanually, everything works fine. I can just interactively provide the Git username and the corresponding password for our Git server when Cargo asks for it.
Now this needs to work non-interactively, in a Docker environment
Adding prefix username:password@ to the index URL unfortunately does not work:
registry URLs may not contain passwords
I also tried to create ~/.cargo/credentials.toml file, as suggested by some sites:
Note that since you have set git-fetch-with-cli=true the one asking for the password is not Cargo, but your Git CLI. Thus you need to tell your Git CLI how to do that, see for example The Vanilla DevOps Git Credentials & Private Packages Cheatsheet for a bunch of ways on how to do that.