0

git clone sub-mod.git

git branch -a

*develop

mybranch #branch exists

git clone --recurse-submodules --branch develop main-project.git

cd path/to/sub-mod

git branch -a

*develop #mybranch not listed so cannot change to that. git pull/fetch did not help

Note: I have added the submodule branch name in .gitmodules

KR29
  • 393
  • 1
  • 4
  • 19
  • Does the develop branch in the main project have the correct submodules defined? I.e. does path/to/sub-mod actually contain the submodule? – Jan Wilamowski Sep 02 '21 at 02:47
  • Yup it contains the submodule. It gives an error saying that particular commit is not found and defaults to develop – KR29 Sep 02 '21 at 02:49
  • And `git remote show origin` gives the submodule's URL, not that of the main project? – Jan Wilamowski Sep 02 '21 at 02:50
  • Can you post the error message? – Jan Wilamowski Sep 02 '21 at 02:52
  • Yes it gives the submodule url. Error is "fatal: git upload-pack: not our ref *** Fetched in submodule path /path/to/sub-mod but it did not contain *** – KR29 Sep 02 '21 at 02:56
  • Have you looked for that error message? e.g. https://stackoverflow.com/questions/61163082/why-does-git-submodule-update-fail-with-fatal-remote-error-upload-pack-not-o – Jan Wilamowski Sep 02 '21 at 03:43

0 Answers0