I want to connect a git Submodule to deepsource.io. It says I need to connect it via SSH. The main repository is hosted on Github, and the Submodule is hosted by Git lab self-managed (git.server.com).
Where do I have to paste the public SSH key from deepsource.io? Do I have to connect it on my account or the Submodule or how?
Once you generate the SSH keys on deepsource.io (by navigating to a repository's Settings > SSH Access > Generate SSH key pair), copy the public key provided and add it as a deploy key to your GitLab submodule repository (Settings > Repository > Deploy Keys). Do not grant write permissions to the key.
Ref: How to enable deploy keys on GitLab.
If you are using HTTPS URLs to specify submodules (look into the .gitmodules
file in the root of the repo), they would need to be changed to SSH URLs. To do so, you can
.gitmodules
file: If the file looks like this:[submodule "screamer"]
path = screamer
url = https://git.myserver.com/org/screamer.git
you can change it to look like
[submodule "screamer"]
path = screamer
url = [email protected]:org/screamer.git
git config --local [email protected]:.insteadOf https://git.myserver.com/
This will change your .git/config
file and look like this:
[url "[email protected]:"]
insteadOf = https://git.myserver.com/