Git Submodules URL are not updated for repositories imported into Bitbucket Server or Data Center
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
:
The .gitmodules
file in main-repo
contains the URL for repo submod-repo1
:
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:
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.