Question

How can use submodules in private repos with Gitlab in DO Apps

When i was try to build Hugo app at 23.02.2020 from Gitlab got fail on theme submodule extracting stage. Console log write

=> Cloning submodules
   warning: error cloning submodules: invalid auth method

I have try with next conditions:

  • project and submodule repos are in different gitlab groups
  • i’m owner of private groups, project and submodule repo
  • submodule has been added as https link
  • also tried to add https link with deploy tokens and there always rise same error.

What i’m doing wrong?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

👋 @DenysK

Great question. Git submodules are a bit of a pain; that said we are iterating on this and trying to make it better in the future. I do have a workaround that will hopefully handle your needs:

This assumes that your submodule is hosted in the same account/team as your app repository.

When an app is created from a GitLab project, we create and assign a deploy key to that project. Our build system uses that deploy key to check out the repository code as well as all submodule repositories. This means we need to enable that deploy key on the submodules repository.

Get the deploy key UUID from the app repo by going to the project, then

  1. Settings
  2. Repository
  3. Deploy Keys
  4. Copy the deploy key name (it’s a UUID)

then go to the submodule repository, and

  1. Settings
  2. Repository
  3. Deploy Keys
  4. Privately accessible deploy keys
  5. Search for the deploy key matching the UUID copied from the above step and click Enable.

You will also need to use the git ssh URL instead of the git https url in your .gitmodules file. So git@gitlab.com:owner/repo.git instead of https://gitlab.com/owner/repo.git.