actions/checkout "Submodule path not initialized"
checkout only fetches submodules when submodules is set. Without it, a later build that expects submodule files finds the path empty/uninitialized.
What this error means
A build fails because a submodule path is empty, or git reports the submodule path is not initialized.
github-actions
fatal: Submodule path 'vendor/lib': not initialized
##[error]Submodule path not initializedCommon causes
submodules not requested
checkout ran without submodules: true, so submodule content was never fetched.
Private submodule auth missing
A private submodule needs a token that can read the other repo.
How to fix it
Request submodules (with token for private ones)
- Set submodules: true (or recursive) on actions/checkout.
- For private submodules, pass a token with access to those repos.
- Re-run; submodule paths populate.
.github/workflows/ci.yml
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.SUBMODULES_TOKEN }}How to prevent it
- Set submodules on checkout whenever the build needs submodule content.
- Use a token with cross-repo read access for private submodules.
Related guides
GitHub Actions checkout "fatal: could not read Username" (submodules)Fix actions/checkout "fatal: could not read Username for https://github.com" on submodules - the default toke…
GitHub Actions Checkout Submodule Fails - Private Submodule AuthFix actions/checkout submodule failures - submodules: true needs a token with access to private submodule rep…
GitHub Actions checkout "submodule recursive auth failed"Fix the actions/checkout error fetching recursive submodules - the default token cannot authenticate to priva…