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,
- [Fixed] Git Clone git@github.com: Permission denied (publickey) Could not read from remote repository Fatal error
- Github: How to Invite Collaborators
- Git Commit - Author identity unknown, Please tell me who you are email
- [Solution] fatal: not a git repository (or any of the parent directories): .git
- [fix] zsh: command not found: git
- Github: fatal: Authentication failed Support for password was removed on August 13, 2021
- Get List of all local branches git command
- Git Revision Questions Before the Interview
- git fatal: Authentication failed error [fix]
- How to Install Git on Ubuntu Linux
- GitHub: How to Search Code
- How to change Git Default Author and Committer details in Eclipse
- How to check your installed version of Git
- Install GitHub Command Line Tool on Mac
- How to Merge Branch into Master Branch
- Perform an Empty Commit in Git without anything in Staging Area
- Git Fix: fatal: refusing to merge unrelated histories Error
- How to undo last Git Commit on Local Repository?
- git command to remove/unstage files from staging area
- Step-by-Step: Setting up Docker + Ubuntu Linux + Git + GitHub Tutorial
- Remove git config at Local, Global or System Levels?
- Fix [oh-my-zsh] Cant update: not a git repository
- Git Config Command - A Deep Dive
- 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 change directory in Git bash
More Posts:
- SharePoint 2016 error - Could not find file ManageUserProfileServiceApplicationTenantSimplified.xml - SharePoint
- Base64 Encoding Decoding in Python Programming - Python
- Fix Microsoft Office 365 error code 135011 - Your organization has disabled this device - Microsoft
- Outlook - The mailbox isn't available. This may have occurred because the license for the mailbox has expired. - Microsoft
- Chrome : When Adobe flash player has finished updating, reload this page to active it - Chrome
- [Fix] zsh: command not found: python on Mac - Python
- [Fix] Docker Run unknown shorthand flag: 'r' in -rm - Docker
- Install SonarLint on Visual Studio Code - HowTos