Reputation: 258
I want to commit a file to a Git repository locally for my sample projects
Failed Attempts to Commit File Locally
Divyanshu (master +) asteroids $ git commit -m "Fire one bullet at a time"
fatal: cannot lock ref 'HEAD': Unable to create 'C:/Users/Divyanshu/Desktop/dktop/focus/
Udacity/Git-hub/version-control/repositories/asteroids/.git/refs/heads/master.lock':
File exists.
Another git process seems to be running in this repository, e.g. an editor opened by 'git
commit'. Please make sure all processes are terminated then try again. If it still fails,
a git process may have crashed in this repository earlier: remove the file manually to
continue.
Upvotes: 1
Views: 69
Reputation: 38
Follow these steps:
Close all the Git terminal or any other editors that are accessing files of that repository
Go to this path:
C:/Users/Divyanshu/Desktop/dktop/focus/Udacity/Git-hub/version-control/repositories/asteroids/.git/refs/heads/master.lock
Delete the file named master.lock
Run your Git terminal again in administrator mode
Then you should try commiting again!
Upvotes: 2