How to load public submodules in a private repo?'s Avatar

19 May, 2020 08:32 PM

I have current appveyor build of a private repo which has just added a submodule reference to a public repo.

When the build kicks off and the private repo is cloned, the submodule is not cloned and the build fails.

I added an install command to initialize the submodule

    - git submodule update --init --recursive
When the `install` phase runs, my build fails with `fatal: not a git repository (or any of the parent directories): .git`

It appears that appveyor is not fetching the parent repo as a git repo, but instead pulls the ZIP of parent repo from GitHub and extracts the ZIP into the project working folder, without the hidden `.git` subfolder that would allow the submodule command to work.

I am currently working around this by explicitly cloning the submodule into the desired parent path, but that is a problematic hack.

I found [this doc page]( which describes how to access a *private* submodule reference, but in my scenario, the submodule is a public repo, accessible to all, so no SSH key setup should be required. However, that page also implies the install command as above, which just won&#39;t work without the magic `.git` folder of the parent.

How can submodules be resolved in an appveyor build?

Is my PR build failure because the first PR which includes the submodule has not actually been merged into the parent? (I don&#39;t like merging a failing build, but maybe submodules require a bootstrap?)</code>
  1. Support Staff 1 Posted by Feodor Fitsner on 19 May, 2020 08:38 PM

    Feodor Fitsner's Avatar

    Hi Doug,

    Make sure you don't have "shallow clone" enabled.

  2. 2 Posted by on 19 May, 2020 09:00 PM's Avatar

    Yep, I do have shall clone enabled!

    And I just realized why (having shallow clone meant not having to add an SSH key to access the parent repo, which is private)

    So I will follow the guidance on for adding an SSH key via a secure variable, and then disabled shallow clone.


  3. Support Staff 3 Posted by Feodor Fitsner on 20 May, 2020 04:09 PM

    Feodor Fitsner's Avatar

    Or, alternatively, you can authorize AppVeyor to GitHub as "AppVeyor" GitHub App - this way the repo will be cloned via HTTPS, not SSH.

  4. 4 Posted by on 20 May, 2020 05:12 PM's Avatar

    Thanks Feodor. We are planning to migrate to the AppVeyor GitHub App for authorization tomorrow.

  5. 5 Posted by on 22 May, 2020 05:30 PM's Avatar

    We made the following changes:
    - switched our authorization mode from the older OAuth to the newer AppVeyor GitHub app - changed the submodule reference from an SSH URL to an HTTPS URL. - disabled shallow clone

    Now the - git submodule update --init --recurserve command in the install: section is working perfectly.

    Thanks for your guidance on this.

  6. Support Staff 6 Posted by Feodor Fitsner on 23 May, 2020 03:43 AM

    Feodor Fitsner's Avatar

    Cool, thanks for the update!

  7. Feodor Fitsner closed this discussion on 23 Jul, 2020 09:02 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac