• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (inactive)
You are here: Home / Computing / Git Submodule fatal: Could not read from remote repository

Git Submodule fatal: Could not read from remote repository

Last updated on April 18, 2014 by Sal Ferrarello

Why to Setup Your Git Submodules as https:// not ssh

I was pulling a public GitHub repo the other day which featured submodules.  The frustrating problem is whenever I tried to init the submodules with the line git submodule update --init --recursive I got the error Git Submodule fatal: Could not read from remote repository

The Issue

This comment on Stack Overflow was the key to understanding the issue using a GitHub public url rather than using a public key.

I was cloning a public GitHub repo and the submodules were also public GitHub repos but I don’t use SSH authentication for GitHub, I use credential.helper osxkeychain and the submodule urls were using the format git@github.com:mileszs/ack.vim.git rather than https://github.com/mileszs/ack.vim.git. The former format requires you access GitHub via SSH, the later allows any public connection.

Please Setup Submodules Using Public URLs

The take-away from all of this is, please use public URLs (https://) not SSH (git@github.com:) when setting up your submodules.

Please Use this

git submodule add https://github.com/salcode/example.git

Not This

git submodule add git@github.com:salcode/example.git

Sal Ferrarello
Sal Ferrarello (@salcode)
Sal is a PHP developer with a focus on the WordPress platform. He is a conference speaker with a background including Piano Player, Radio DJ, Magician/Juggler, Beach Photographer, and High School Math Teacher. Sal can be found professionally at WebDevStudios, where he works as a senior backend engineer.

Share this post:

Share on TwitterShare on FacebookShare on LinkedInShare on EmailShare on Reddit

Filed Under: Computing Tagged With: Git

Reader Interactions

Comments

  1. this guy says

    May 12, 2014 at 11:17 pm

    I have fun with, result in I found exactly what I
    was having a look for. You have ended my 4 day lengthy hunt!
    God Bless you man. Have a great day. Bye

    Reply
    • Sal Ferrarello says

      May 13, 2014 at 6:10 am

      Glad to hear this article helped. Thanks.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in