Submodule issues

1. Authentication errors

The most common errors involve problems with authentication in the Git service hosting the submodule.

SSH

ERROR: There was a problem with fetching the submodules. git@github.com:buddy/myRepo.git: Cannot log in at github.com:22 ERROR: There was a problem with fetching the submodules. git@github.com:buddy/myRepo.git: Auth fail

This error is connected to missing or incorrectly configured SSH keys. The key from Buddy is available in the project settings:

Image loading...Submodule settingsSubmodule settings

The key needs to be uploaded to the submodule's hosting service. This is performed either in the settings of the submodule repository, or the settings of the user who has access to that repository. The exact location varies, depending on the Git provider. Possible names include Authorised keys, Deploy keys, SSH keys, or SSH and GPG Keys.

HTTPS

ERROR: There was a problem with fetching the submodules. https://buddy@bitbucket.org/buddy/myRepo.git: https://buddy@bitbucket.org/buddy/myRepo.git/info/refs?service=git-upload-pack not found: Not Found

In the case of HTTPS, Buddy authenticates in the submodule with the credentials configured in the integration with the Git provider. In other words, if you added a project with Github, the submodules will work with GitHub repositories only. Also, the user provided in the integration details must have access to the submodule repository.

Hint
None of the above apply to public repositories which do not require authentication.

2. Other types of errors

Debugging submodule errors can be tricky as it's often hard to identify what exactly went wrong. Sometimes the problems result from wrong understanding of how submodules work. Such cases include, for example, adding or editing the address of the submodule in the .gitmodules file. In such case, Buddy will produce a message pointing to the submodule that is causing errors:

WARNING: Problem with submodules. [git@bitbucket.org:buddy/myRepo.git]

Any manual modification of .gitmodules is certain to cause issues, because submodule info is also stored as metadata in the .git directory. If this happened to you, the best idea is to remove the submodule and add it again.

Success
To fully understand how submodules work, make sure to visit https://git-scm.com/book/en/v2/Git-Tools-Submodules.
Last update:
Sep 23, 2024