Coding⏱️ 2 min read📅 2026-05-31

How to Fix: Git: fatal: Pathspec is in submodule

Git error when trying to add submodule files

Quick Answer: Try using 'git add -f' or 'git add --force' to force the addition of submodule files.

To resolve the 'Git: fatal: Pathspec is in submodule' error, follow these steps:

🛠️ Step-by-Step Verified Fixes

Method 1: Update Submodule

  1. Step 1: Run the following command in your terminal to update the submodule:
  2. git submodule update --init --recursive

Method 2: Use Git Submodule Command

  1. Step 1: Run the following command to add all files in the submodule to the staging area:
  2. git add submodule//*

🎯 Final Words

By following these steps, you should be able to resolve the 'Git: fatal: Pathspec is in submodule' error and successfully deploy your Hakyll static site on TravisCI.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions