I have a git repository with three submodules. The containing repository has two branches master and develop. All submodules only have one branch – the master branch.
When the containing repository is on the master branch, pushing to origin via git push --recurse-submodules=on-demand works as expected. Both the containing project as well as its submodules are pushed.
Now here is the problem. When the containing repository is on the develop branch, I am getting a problem when pushing via git push --recurse-submodules=on-demand. The push operation is cancelled and an error message is printed.
Here is the full output I get from git:
$ git push --recurse-submodules=on-demand
fatal: src refspec 'refs/heads/develop' must name a ref
fatal: process for submodule 'Frameworks/OpenLearnWareClient' failed
I can mitigate this problem by first pushing changes in each submodule manually and then pushing the containing repository. This however is very tedious and defeats the purpose of --recurse-submodules=on-demand.
Here is my .gitmodules file:
[submodule "Frameworks/OpenLearnWareKit"]
    path = Frameworks/OpenLearnWareKit
    url = git@github.com:kaiengelhardt/OpenLearnWareKit.git
    branch = master
[submodule "Frameworks/OpenLearnWareClient"]
    path = Frameworks/OpenLearnWareClient
    url = git@github.com:kaiengelhardt/OpenLearnWareClient.git
    branch = master
[submodule "Frameworks/KEFoundation"]
    path = Frameworks/KEFoundation
    url = git@github.com:kaiengelhardt/KEFoundation.git
    branch = master
I am using git version 2.20.1 (Apple Git-117).
Does anybody know what is going wrong here and how to make recursive pushing work?
 
    