Interview Prep/Git & GitHub/Submodules, LFS and Hooks

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.

All Git & GitHub questions Roadmap: Git & GitHub

More on Submodules, LFS and Hooks