Open In App

Git – A lock file already exists in the repository, which blocks this operation from completing

Improve
Improve
Like Article
Like
Save
Share
Report

Here we will create a new repository with GitHub desktop in a small illustrative react app. Here when we commit we are supposed to get an error in order to illustrate via error message as a lock file already exists in the repository, which blocks this operation from completing. Do check here we are demonstrating GitHub Desktop version1.3.4 on Windows OS.

Steps to Reproduce

  1. Add Local Repository. Choose Repository. Get redirected to create a new repository.
  2. Create a new repository in the project folder
  3. Commit(Try to) and get the error message: A lock file already exists in the repository, which blocks this operation from completing.

Expected Behavior: Commit goes through

Actual Behavior: Get Error Message: A lock file already exists in the repository, which blocks this operation from completing.

A lock file already exists in the repository, which blocks this operation from completing.

 

Error: If you go to commit your file in GitHub Desktop then you get this error.

We need to follow the below steps in order to solve the above ambiguity that is as follows depicted through visual aid for better understanding as here we are using GitHub Desktop: 

Step 1: Open the folder in your system.

Open the folder in your system

 

Step 2: Click on { 3. (…) after options }.

Select Options

 

Step 3: Click view

Click view

 

Step 4: Hidden file and folder > Show hidden file and folder ( click on ) and click on ok.

Show hidden file and folder

 

Step 5: Open the .git folder and delete the index.lock.

delete the inde x.lock.

 

Step 6: Now, open GitHub Desktop

open GitHub Desktop

 

Step 7: Click on the commit.

Click on the commit

 

As seen from the above media Commit goes through and our problem is solved earlier where we were getting an error message. 


Last Updated : 18 Aug, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads