➜ /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 <file>..." to include in what will be committed) sample.txt nothing added to commit but untracked files present (use "git add" to track)
Have Questions? Post them here!
- Git: Delete Branch Locally and Remotely at Origin
- How to change directory in Git bash
- [Solution] fatal: not a git repository (or any of the parent directories): .git
- Get List of all local branches git command
- How to check your installed version of Git
- 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.
- git command to remove/unstage files from staging area
- fix fatal: --local can only be used inside a git repository error
- Github: How to Invite Collaborators
- How to Install Git on Windows
- Get the file location of git config values
- Change the default diff or commit editor for git
- GitHub: How to Search Code
- [fix] zsh: command not found: git
- Setup Git + Visual Studio Code Tutorial
- Fix [oh-my-zsh] Can't update: not a git repository
- [fix] fatal: this operation must be run in a work tree in git
- Git: Step-by-Step - How to Push Local Brach to GitHub
- How to ignore files in git using .gitignore file
- Rename git branch on Local and GitHub Remove using Command
- Change the default git branch name from master to main
- Github: fatal: Authentication failed Support for password was removed on August 13, 2021
- Git Remove Untracked Files using Command
- git fatal: Authentication failed error [fix]
- Git Rename master branch make to main using Command
- Fix SharePoint 2019 installation error This product requires Visual C++ Redistributable Package for Visual Studio 2017 - SharePoint
- [Android Studio] Could not automatically detect an ADB binary - Android-Studio
- How to fix command not found brew (bash, zsh) on macOS Terminal - MacOS
- Error: Can not find the tag library descriptor for - Java
- 5 Programming Languages to Learn in the Year 2021 - News
- How to reset eclipse layout - Android