Github 2FA + Private Submodule + Deploy Keys Won't Work

Deploy Keys won’t work if you have 2FA turned on for GitHub. You have to use a Personal Access Token.

I’m trying to bring in a Private Submodule into a Site and getting an error during the Build step of Deploy. The Site also has a Public Submodule as part of it’s Repo, and that builds fine. Here is the error:

4:43:39 AM: Error checking out submodules: Submodule 'NAME'
fatal: could not read Username for 'https://github.com': No such device or address

Besides moving the Private submodule out into it’s own site, what options do I have?

BTW, I’ve added the Deploy Key to the Submodule’s repo per the Docs, got error, moved Key to Site’s repo, got error, moved Key to my profile, got error. Deleted Site from Netlify, re-added and tried again with new Key, still error.

I’ve read this and the Docs too:

Hey Mark and super sorry for the slow reply! Somehow we missed your question at first.

You don’t need a new site; to address that error you need to make sure your submodule uses the SSH-format URI - git@github.com:user/project.git - rather than https:// which you are using based on that error message:

4:43:39 AM: Error checking out submodules: Submodule 'NAME'
fatal: could not read Username for 'https://github.com': No such device or address

…which indicate it is in https://github.com format, which does NOT use a deploy key. This change is probably needed in .gitmodules.

Additionally, you will almost certainly get a github error if you try to “reuse” a key that is already in place, so you will probably need to regenerate in our UI one more time in case you’ve already imported the existing key somewhere (as long as that “somewhere” is not on the submodule repo).