SSH Key For Submodules (Deploy Key)

Hi there!

I was reading: [Common Issue] How do I access private repositories in the build environment?

May I please get the SSH key that I can add to my “bot” Github Account? I’d like to use multiple submodules.

The site in question is “rickyrombo”

Thank you!

Hi @rickyrombo! Welcome to netlify community.

Sure thing! The public deploy key for the rickyrombo site is:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVpEicmkJPZJwjX5+7Okp7fA7jaFK7Cek2/H65DQ4b2Qlvog+Hx5g2QXUBEtNRP/KDjvhVDWvGtlH12lQfym2nEIX5nR8WGWo0oJ7LQoky9y0dNomw6aUl5OgNOF9n4DurFTBh5dxZMdHcuR3tDuJ1tRqfWtq09Cx+DLO/7NcTix6SWgKyi3zGz+1ct+d855+UjO474MiTbVYdphPy7PmwgP8ZUZVwKYdAcfq3sDZ0hedfiX1KJ1bnBGf5j/vyuB5Obupvp8qaDuDJygGbznMCHFHHJ6MbDYujUcP7ObFmbgsCvk2vXCNp1OG3hKOx4aV8iC3BWdfEw2yX0oW7nEv9

Awesome thank you!

I added the key to my “machine” account - but when I try to link via the Netlify UI I don’t see my repositories. I invited the machine account to both private repos as a collaborator and accepted the invite - I see the repositories on the left sidebar on GitHub under that user. Is there anything I’m missing?

Marcus

I’ve now also tried to use that public key as an actual “Deploy Key” on the submodule repository itself and it still fails to deploy - can you double check that it’s correct? I get “Host key verification failed.”

Hi, @rickyrombo. The git repo was “relinked”. This relinked changes the SSH key. The new key for that repo is:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgnz+c7wTYLZ51aXdU7SfpI5wmy2HfasrsrmGsxGPYmx0FrwPzZ7ncnQw7uEG0WtrJF9CT6h49W9LEwr7C3MUWPeyrOead0HBp+55lnjHmwKBm7Zy7rNtBo6Nx0j4ZUXOLPUQaUQ0hoRp3+ArCa8GkYlIQyVYhr0YjEoAtWh7UUYVje7pfGnk7VevYt10M2BLo9Xxt2ZzalEoygI7aQ3WLhcOdWy+DMhNQQb+2r7tAIUthY5/h8TzSxVf8n8npiIbnRYU2DM8yJIFyazhBbZzuseMDP9cHVwQ90tjYflxeBmjAGGEq3qauojJ2kaRCs1wWl9DDr7tOkP4/qeRzg5Db

Please note:

  1. Assign the deploy key I just generated as a read-only deploy key in your repository settings at GitHub (https://github.com/account/project/settings/keys). See below for this key. NOTE: It will only work on this site; we have to generate separate ones for other sites, so please let me know if you need to enable that workflow elsewhere too.

  2. Once it’s in place, when we check out the first repo to build, we’ll fetch the submodule with this deploy key and this will work!

  3. You can use this workflow with multiple private submodules attached to the same repository, but that does take some extra work since GitHub does not allow Deploy Keys to be used in multiple places. You’ll have to instead add them to a user (perhaps you? or maybe a robot-account that you create on GitHub) that has access to all repos.