Search code examples
gitgithubgit-submodules

Cannot initialize submodule (branch of private repository)


Please observe that I have two branches in a private repository: master and content, the latter being a submoudle of the former -

image

git clone --recurse-submodules https://github.com/vishvAsa/rahaShTippanyaH.git succeds just fine - except for the submodule content.

The below fails as well:

git submodule update --init --remote                                                                 ✔  5m 9s  
Cloning into '/home/vvasuki/gitland/vishvAsa/rahaShTippanyaH/content'...
sign_and_send_pubkey: signing failed for RSA "vishvas.vasuki@gmail.com" from agent: agent refused operation
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

But the error mentioned does not make sense since I was able to clone the exact same private repository without the content submodule. Further ssh-add -l shows an rss key.

Is this a github bug? How to fix? (Switching submodule upstream to https://github.com/vishvAsa/rahaShTippanyaH.git or https://vvasuki@github.com/vishvAsa/rahaShTippanyaH.git did not help.)


Solution

  • Switching to the HTTPS URL should have helped, since the initial clone succeeds.

    But try and set GIT_SSH_COMMAND:

    export GIT_SSH_COMMAND='ssh -Tv'
    

    That way, you will see which key is tried for this clone.
    Check also that ssh -Tv git@github.com does return Hi vvasuki! You've successfully authenticated, but GitHub does not provide shell access.
    As long as this first check does not succeed, any SSH URL would fail.