Private SSH Dependency on Gitlab

I created a private repository I am trying to consume with dependency:

The proper GIT origin URL is in form git@gitlab.com:group/project.git. When trying to add I run into 2 types of errors: fail to parse port (group is not a number) or invalid URL base.

I tried variations:

[dependencies]
projectName = { git = "ssh://git@gitlab.com:group/projectName.git " }
projectName = { git = "git@gitlab.com:group/projectName.git " }

The git shorthand syntax for ssh URLs is not supported by Cargo. See the appendix of the Cargo book:

Note: Cargo does not support git's shorthand SSH URLs like git@example.com:user/repo.git. Use a full SSH URL like ssh://git@example.com/user/repo.git.

I believe replacing the : with / in front of your group should be working in your case:

[dependencies]
projectName = { git = "ssh://git@gitlab.com/group/projectName.git " }
1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.