ProjectStack
git

error: pathspec did not match any file(s) known to git

Git couldn't find the branch, tag, or file you referenced. The name you provided doesn't match anything in the repository's history or working tree.

Common causes

  • Trying to checkout a branch that doesn't exist locally — you need to fetch it first
  • The branch name has a typo or uses the wrong case
  • The remote branch exists but you haven't run git fetch yet
  • Trying to checkout a file path that Git doesn't track

How to fix it

  1. Fetch all remote branches first: git fetch --all
  2. List available branches: git branch -a
  3. Checkout with the correct remote tracking name: git checkout -b <branch> origin/<branch>
  4. If the file doesn't exist yet, it can't be checked out — verify the path

Example

error: pathspec 'feature/login' did not match any file(s) known to git

Running git checkout feature/login without fetching from remote first

Have a different error?

Paste any error message into the Error Translator to get an instant explanation.