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. Make sure no other git
process is running and remove the file manually to continue.
If you get the above fatal error when you are trying to run a git command like git checkout branch-name on your command line or terminal, well then you need to delete the index.lock file located under .git/ directory.
How to resolve fatal: Unable to create '/c/git_repo/.git/index.lock': File exists.
- Go to your git repository directory,
- now type cd .git,
- Now type rm-f index.lock if you are using Linux/macOS
- or type del index.lock if you are using Windows
- Now try your command it should work
$ git checkout master
M hello.py
A myfile.py
A Sample.java
Switched to branch 'master'
$
More Posts related to Git,
- Fix [oh-my-zsh] Cant update: not a git repository
- [fix] fatal: pathspec index.html did not match any files error
- How to ignore files in git using .gitignore file
- Git Fix: fatal: refusing to merge unrelated histories Error
- Install GitHub Command Line Tool on Mac
- How to change directory in Git bash
- Get List of all local branches git command
- fix fatal: --local can only be used inside a git repository error
- [git] fatal: your current branch 'main' does not have any commits yet
- Git Revision Questions Before the Interview
- Change the default git branch name from master to main
- git command to remove/unstage files from staging area
- Remove git config at Local, Global or System Levels?
- [fix] fatal: this operation must be run in a work tree in git
- Clone a particular remote brach using git clone command
- How do I get a list of all branches in Git?
- How to check your installed version of Git
- Step-by-Step: How to delete a git branch from local as well as remote origin
- Git Commit - Author identity unknown, Please tell me who you are email
- 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.
- How to Rename a Git Local Branch Using the --move Option
- Perform an Empty Commit in Git without anything in Staging Area
- [Fixed] Git Clone git@github.com: Permission denied (publickey) Could not read from remote repository Fatal error
- GitHub: How to Search Code
- Rename git branch on Local and GitHub Remove using Command
More Posts:
- How to change the KeyMap in Android Studio - Android-Studio
- How to delete a file using PowerShell [Windows/macOS] - Powershell
- M1/M2 Mac VirtualBox Unsupported hardware architecture detected! - MacOS
- [Docker M1/M2 Mac] qemu-x86_64: Could not open /lib64/ld-linux-x86-64.so.2: No such file or directory AWS CLI - Docker
- wget Command on macOS Terminal - MacOS
- Android Parsing Data for android-L failed Unsupported major.minor version 51.0 Error - Android
- [Fix] java: integer number too large compilation error - Java
- Setting up Java JUnit Project with Eclipse + Maven Example - Java