• Register
0 votes
2.4k views

Problem :

I am new to GIT. I have recently created a new repository with github desktop but I couldn’t add local repository for some reason in my react app. When I try to commit I get the error message as follows: “A lock file already exists in the repository, which blocks this operation from completing.”

I have tried to delete the package-lock.json file but it is not helping. My react build is not running. I have no idea what causes this issue.

  • GitHub Desktop version : 1.3.4
  • Operating system version : Windows 7Home Premium 64-Bit
6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

You will often face this issue when the Git crashes unexpectedly. Now to resolve this issue you need to go to your hidden .git directory shown in the error message and you need to delete the index.lock file located there.

You will need to enable the viewing hidden files and folders on Windows.

To access the log files you need to go to the file menu in GitHub Desktop and select Help > Show Logs in Finder (for macOS) or Explorer (for Windows). The log files are created daily.

For those are using Unix/Mac/etc

In your terminal when you are at project root just delete it manually if you can't see it use following command:

rm -rf ./.git/index.lock

After deleting the index.lock file you can do commit using GitHub Desktop again.

9 7 4
38,600 points

Related questions

0 votes
1 answer 25 views
25 views
Problem: Did anyone have faced this error : A lock file already exists in the repository, which blocks this operation from completing.
asked Mar 13 Wafa Abu Yousef 6.1k points
0 votes
1 answer 47 views
47 views
Problem : Currently I am trying to use TortoiseGit on Windows. But when I want to Clone from a context menu of my standard Windows Explorer, I face below error: Please make sure you have the correct access rights and the repository exists How can I make my git work properly?
asked Jan 10, 2020 alecxe 7.5k points
0 votes
1 answer 80 views
80 views
Problem : I am trying to use the TortoiseGit on my Windows. But when I want to Clone it from my context menu of the standard Windows Explorer then I face below error: Please make sure you have the correct access rights and the repository exists In more detail the complete snapshot of ... exit cleanly (exit code 128) (21450 ms @ 17.12.2019 10:36:58) What should I do to make my git work correctly ?
asked Dec 19, 2019 alecxe 7.5k points
1 vote
2 answers 49 views
49 views
Problem: How to fix this error? Fatal: a branch named 'gh-pages' already exists.
asked Mar 30 PkGuy 23.5k points
0 votes
1 answer 5 views
5 views
Problem: I am getting this message on GitHub: "fatal: remote origin already exists." Tell me a good way to remove it.
asked Apr 17 anika11 32k points
0 votes
1 answer 4 views
4 views
Problem: I have my project on GitHub at some location, *Emails are not allowed*:myname/oldrep.git. Now I want to push all my code to a new repository at some other location, *Emails are not allowed*:newname/newrep.git. I used the command: git remote add origin *Emails are not allowed*:myname/oldrep.git but I am receiving this: fatal: remote origin already exists. What can I do now?
asked Apr 17 anika11 32k points
0 votes
0 answers 8 views
8 views
Problem: I'm still going through some guides on RoR and I'm stuck here at Deploying The Demo App, it outputted this: fatal: No configured push destination. What can I do here? Any help would be much appreciated.
asked Apr 19 ummesalma 29.2k points
1 vote
1 answer 3 views
3 views
Problem: How to fix this? Remote: this repository moved. please use the new location:
asked Apr 25 PkGuy 23.5k points
0 votes
1 answer 5 views
5 views
Problem: I've cloned a private repo, forked it and made som changes into a feature branch. When I try to push these changes into the repo i get the following message: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the ... to push with git push --set-upstream origin but it's just showing me the same error. Have anyone of you seen this before?
asked Apr 24 sumaiya simi 43.9k points
0 votes
1 answer 10 views
10 views
Problem: I tried to find out the solution on the web when I face this problem but I did not get any fruitful information that I can continue if you read the above question and understand what is the solution of this please cooperate with me- Thanks
asked Mar 21 rubelkhan 20.4k points