In GitHub Actions, checking out submodules fails with `fatal: could not read Username for 'https://github.com': terminal prompts disabled`.
IntermediateTroubleshootingSubmodules, LFS and Hooks
Answer
Likely causes → The submodule is a private repo. The default GITHUB_TOKEN is scoped to the current repository only, so it cannot clone other private repos. SSH URLs in .gitmodules fail similarly with Permission denied (publickey).
Diagnose → Check .gitmodules URLs and the checkout step's token / ssh-key inputs.
Fix → Give checkout a credential that can read the submodule repo:
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.SUBMODULE_READ_TOKEN }} # fine-grained PAT or GitHub App token
# or: ssh-key: ${{ secrets.SUBMODULE_DEPLOY_KEY }}
Prefer relative URLs in .gitmodules (url = ../common.git) so they follow the parent's protocol.
Prevent → Use a GitHub App installation token with read-only access to the needed repos instead of a personal PAT.
More on Submodules, LFS and Hooks
`fatal: No url found for submodule path 'libs/common' in .gitmodules`IntermediateAfter cloning, the submodule directories exist but are empty.Beginner`git submodule update` fails: `fatal: remote error: upload-pack: not our ref 3f2a9c1...` and `Fetched in submodule path 'libs/common', but it did not contain 3f2a9c1. Direct fetching of that commit failed.`Intermediate`git status` keeps showing `modified: libs/common (new commits)` even though you never touched it.BeginnerYou committed inside a submodule, ran `git submodule update`, and your commits vanished.Intermediate`git submodule add` fails with `fatal: 'libs/common' already exists in the index`.Intermediate