• 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

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 32 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 alecxe 7.5k points
0 votes
1 answer 41 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 531 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
2 answers 178 views
Problem : I want to convert the Milliseconds in the format of number of years months weeks and days. e.g. 10 months, 4 weeks and 5 days I have already tried in few ways but it is becoming as 7 days and 0 weeks. Please find below my code for your referance: int weeks = ... am trying the logic by adding 1 to number of days as if I have 23 hours it should be 1 day. Please give me the solution on it.
asked Dec 2, 2019 alecxe 7.5k points
1 vote
1 answer 218 views
Problem: Can any one help me? Which command could you use to verify if a crontab file exists for user thobbs?
asked Feb 22 maddi86 5.4k points