After migration to the cloud, repositories with submodules can no longer be cloned
Asked by Michael Huber:

After migration to the cloud, repositories with submodules can no longer be cloned.

All repositories **without submoduls work fine** (clone, commit...). However, repositories **with linked submodules are denied access**.

I edit the new link in gitmodules file online (bitbucket)

Structure of repository**:** repo coffeecontrol use submodules Mecofw and milkunit. Mecofw using submodules: FreeRtos, paho.mgtt-sn.embedded-c and paho.mgtt.embedded-c

My unsuccessful steps to clone:

1. clear local projects  
2. open SourceTree  
3 .open Clone-Wizzard via File/Clone/New   
4. open Bitbucket  
5. navigate to repository and copy SSH-Link via Button "Clone"  
6. paste link into Clone-Wizzard (it schows that is a valid Git-repository)  
7. define local path  
8 .choose branch: master  
9. clone depth: 0  
10. recurse submodules: checked  
11. no hardlinks: unchecked  
12. start to clone

Cloning is aborted with the following **error messages** (new "cloud link: git@bitbucket.org:aequator/mecofw.git, old ssh://git@scm.aequator.ch:7999/freer/freertos.git):

git -c filter.lfs.smudge= -c filter.lfs.required=false -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks clone --branch master --recursive git@bitbucket.org:aequator/coffeecontrol.git C:\\work\\coffeecontrol  
Cloning into 'C:\\work\\coffeecontrol'...  
Submodule 'lib/mecofw' (git@bitbucket.org:aequator/mecofw.git) registered for path 'lib/mecofw'  
Submodule 'lib/milkunit' (git@bitbucket.org:aequator/milkunit.git) registered for path 'lib/milkunit'

Cloning into 'C:/work/coffeecontrol/lib/mecofw'...  
Cloning into 'C:/work/coffeecontrol/lib/milkunit'...  
Submodule path 'lib/mecofw': checked out '6400f06fdfcd7417626db4569420194ba71205ee'  
Submodule 'ExtLibs/FreeRTOS' (ssh://git@scm.aequator.ch:7999/freer/freertos.git) registered for path 'lib/mecofw/ExtLibs/FreeRTOS'  
Submodule 'ExtLibs/paho.mqtt-sn.embedded-c' (ssh://git@scm.aequator.ch:7999/elf/paho.mqtt-sn.embedded-c.git) registered for path 'lib/mecofw/ExtLibs/paho.mqtt-sn.embedded-c'  
Submodule 'ExtLibs/paho.mqtt.embedded-c' (ssh://git@scm.aequator.ch:7999/elf/paho.mqtt.embedded-c.git) registered for path 'lib/mecofw/ExtLibs/paho.mqtt.embedded-c'

Cloning into 'C:/work/coffeecontrol/lib/mecofw/ExtLibs/FreeRTOS'...  
FATAL ERROR: Network error: Connection timed out  
fatal: Could not read from remote repository.

Please make sure you have the correct access rights  
and the repository exists.  
fatal: clone of 'ssh://git@scm.aequator.ch:7999/freer/freertos.git' into submodule path 'C:/work/coffeecontrol/lib/mecofw/ExtLibs/FreeRTOS' failed  
Failed to clone 'ExtLibs/FreeRTOS'. Retry scheduled


Answers:
author: Ben
body: Hey Michael,

Based on the error messages you have received - it appears that the paths for some of the submodules are incorrect, and therefore the clone command fails as it can't access the URL.   
For example - this should read **ssh://git@bitbucket.org/freer/freertos.git:**
> Submodule 'ExtLibs/FreeRTOS' (ssh://git@scm.aequator.ch:7999/freer/freertos.git) registered for path 'lib/mecofw/ExtLibs/FreeRTOS'

You will need to modify the URL's in your .gitmodules file for the paths which receive an error as listed in your output above, and then run the following command to reflect the changes:

    git submodule sync --recursive

There is a guide detailing the steps located here:  
<https://stackoverflow.com/questions/913701/how-to-change-the-remote-repository-for-a-git-submodule>

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)


Tags: bitbucket

cloud

submodule