• Register
0 votes

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 42 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 72 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
0 votes
1 answer 1K views
Problem : I am working on the project remotely through the command line on the machine to which I don't have the admin rights and after running git push origin master I get the below error message: (gnome-ssh-askpass:29241): Gtk-WARNING **: cannot open ... to host github.com port 22: Connection timed out fatal: The remote end hung up unexpectedly Does anyone have any solution for my issues?
asked Dec 11, 2019 alecxe 7.5k points
0 votes
1 answer 2 views
Problem: mklink cannot create a file when that file already exists.
asked Feb 23 Ethan ross 1.8k points
0 votes
1 answer 30 views
Problem: Hey, i have been facing this error again and again When I input $ vagrant box list, Terminal outputs: centos64 (virtualbox) Now I input $ vagrant init centos64, Terminal outputs an error message: "Vagrantfile" already exists in this directory. Remove it before running "vagrant init". Is there any way to resolveb this error, so please tell me. this is impotant to me
asked Feb 6 charles mathews 3.8k points
0 votes
1 answer 11 views
Problem: I have created a local branch that I want to 'push' upstream from. There is a similar question here on Stack Overflow on how to keep track of a newly created remote branch. However, my workflow is slightly different. First I want to create a local branch, and I ... google searches don't seem to come up with anything). How do I tell my colleagues to pull it from the top of the repository?
asked Feb 15 sasha 13.2k points
0 votes
1 answer 10 views
Problem: I want to delete a branch both locally and on my remote fork of the project on github. Successful deletion of local branch $ git branch -D bugfix Deleted branch bugfix (was 2a14ef7). Attempts to delete remote branches $ git branch -d remotes/origin/ ... Already up-to-date. What do I need to do differently to successfully delete the branch remotes/origin/bugfixboth locally and on GitHub.?
asked Feb 12 sasha 13.2k points
0 votes
1 answer 18 views
18 views asked Oct 2, 2020 SapperIt 1.2k points