Git Submodules URL are not updated for repositories imported into Bitbucket Server or Data Center

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

After importing code from other Git hosting providers into Bitbucket, Git submodule URLs are not automatically updated.

Example

In this sample, we have a repo called main-repo in Bitbucket Cloud (bitbucket.org) that has a submodule called submod-repo1:

(Auto-migrated image: description temporarily unavailable)

The .gitmodules file in main-repo contains the URL for repo submod-repo1:

(Auto-migrated image: description temporarily unavailable)

When both the main-repo and submod-repo1 repositories are imported into Bitbucket Server/Data Center, it might be assumed that the URL in the .gitmodules file will be updated to reflect Bitbucket Server's base URL.

However, the submodule URL is not changed and still refers to the source.

For the sample above, the .gitmodules file would still contain the following, which still points to the Bitbucket Cloud repo:

(Auto-migrated image: description temporarily unavailable)

This is expected behaviour. 

Bitbucket does not update any repository content during import, so the .gitmodules file is not updated.

In addition, it is not possible to know in advance what the intended URL for the submodule should be. Git allows the main repo to be on one remote location and have submodule(s) to be in other remotes.

Solution

Update the submodule URL in the .gitmodules file manually.

Updated on March 18, 2025

Still need help?

The Atlassian Community is here for you.