I have my repository in the git
. in the local copy ( my system ) I have made some changes on one of the files.
and I tried to update that file to git
repository. for that I am running the following command :
git commit -a "text file updated"
But i am getting a error as like this:
$ git commit -a
fatal: Unable to create 'D:/Projects/gitProjects/color-palette/.git/index.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git process is running and remove the file manually to continue.
what is the problem here? and how to solve this? what I do is the correct way to update the file from local to git right?
The problem is that you simply have a lock file.
You can delete if and once you delete it fetch the remote repository:
# delete the lock file
rm -rf .git/index.lock
# update the local repository
git fetch --all --prune
Once you do it your local repo is updated with the remote repo.
Commit your changes and then you can pull the changes into your branch
# add all the changes
git add .
git commit -m "Message"
# pull the changes which were added to the remote
git pull origin <branch name>
In this case you should try to re-clone your project and once you have it copy the desired changes files onto the second clone and then commit them.