➜ /myrepo git:(master) git add index.html fatal: pathspec 'index.html' did not match any files
If you are trying to add a file to staging area using git command and you get the fatal pathspec did not match any files error, well reason could be one of the below,
- The file that you are trying to add to the staging area does not exist.
- You have misspelled the filename.
- You are in the wrong branch.
You can run the git staus command to check if the file exists or the correct name of the file in the untracked list of files,
➜ /myrepo git:(master) ✗ git status On branch master No commits yet Untracked files: (use "git add
..." to include in what will be committed) sample.txt nothing added to commit but untracked files present (use "git add" to track)
- Get List of all local branches git command
- git fatal: Authentication failed error [fix]
- How to change directory in Git bash
- How to remove or unstage a file from git staged area
- How to Install Git on Ubuntu Linux
- [fix] zsh: command not found: git
- How to check your installed version of Git
- How to Install Git on Windows
- How to Merge Branch into Master Branch
- [fix] fatal: pathspec index.html did not match any files error
- fatal: Unable to create '/c/git_repo/.git/index.lock': File exists. If no other git process is currently running, this probably means a git process crashed in this repository earlier.
- List of Java versions - Java
- Installing Native Chrome Browser App on M1 Mac Device - Chrome
- Audio Video Network protocols supported by Android OS Devices - Android
- [Notepad++] Remove CR Carriage Return and LF Line feed (CRLF) - NotepadPlusPlus
- auth_client_using_bad_version_title : Error Android Lint - Android
- Ubuntu zsh: command not found: nano - zsh
- Can we move apps like WhatsApp, Facebook to external MicroSD card - WhatsApp
- MacOS Safari Fullscreen Keyboard Shortcuts - MacOS