Can't push a commit of Git repo with a submodule

I’ve recently added submodule “C” to my repo “B”, then checked out a particular commit in submodule C (a previous release of that tool I want to include in B), then committed B and attempted to push. I get this error:

$ git push --recurse-submodules=on-demand

  • Mirroring git branch
  • Git Not Committing Directory Contents
  • How to delete a specific revision of a github gist?
  • git merge origin/branch vs. merge branch locally
  • How do you keep secrets.yml secret in rails?
  • Fixing git warning: “updating the currently checked out branch; this may cause confusion”
  • Everything up-to-date
    The following submodule paths contain changes that can
    not be found on any remote:
      _submodules/C
    
    Please try
    
            git push --recurse-submodules=on-demand
    
    or cd to the path and use
    
            git push
    
    to push them to a remote.
    
    fatal: Aborting.
    fatal: The remote end hung up unexpectedly
    gitpub error:  process git-shell failed with status 128
    

    I should mention that the commit in C that I have checked out is parentless/detached (not sure why the developer opted to have it this way). This appears to cause an issue when I want to push my commit in B. It might also be relevant to mention that B is a submodule of a superproject A as well.

    Thanks for any insight you may be able to provide.

  • Git pre-svn-dcommit hook
  • Git merge strategy 'theirs' is not resolving modify/delete conflict
  • Cannot push my ruby app to heroku
  • What git commands do “hexo init <folder>” exactly do?
  • Forking (postgre)SQL database structure
  • Replying on the same thread in a mailing list using git send-email
  • One Solution collect form web for “Can't push a commit of Git repo with a submodule”

    Ok, being relatively new to Git, I missed that the push command should NOT have included --recurse-submodules for my purposes. I believe I got the message I did because it thought I wanted to also push a commit to the submodule, for which there was no branch.

    Git Baby is a git and github fan, let's start git clone.