`Git` - 更新给出错误 [.git/index.lock':文件存在。]
`Git` - update giving the error [.git/index.lock': File exists.]
我在 git
中有我的存储库。在本地副本(我的系统)中,我对其中一个文件进行了一些更改。
我尝试将该文件更新到 git
存储库。为此,我 运行 以下命令:
git commit -a "text file updated"
但是我收到这样的错误:
$ 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.
这里有什么问题?以及如何解决这个问题?
我所做的是将文件从本地更新到 git 的正确方法,对吗?
问题是您只有一个锁定文件。
你可以删除,一旦你删除它获取远程存储库:
# delete the lock file
rm -rf .git/index.lock
# update the local repository
git fetch --all --prune
完成后,您的本地存储库将更新为远程存储库。
提交您的更改,然后您可以将更改拉入您的分支
# add all the changes
git add .
git commit -m "Message"
# pull the changes which were added to the remote
git pull origin <branch name>
删除索引不起作用怎么办?
在这种情况下,你应该尝试重新克隆你的项目,一旦你有了它,将所需的更改文件复制到第二个克隆中,然后提交它们。
我在 git
中有我的存储库。在本地副本(我的系统)中,我对其中一个文件进行了一些更改。
我尝试将该文件更新到 git
存储库。为此,我 运行 以下命令:
git commit -a "text file updated"
但是我收到这样的错误:
$ 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.
这里有什么问题?以及如何解决这个问题? 我所做的是将文件从本地更新到 git 的正确方法,对吗?
问题是您只有一个锁定文件。
你可以删除,一旦你删除它获取远程存储库:
# delete the lock file
rm -rf .git/index.lock
# update the local repository
git fetch --all --prune
完成后,您的本地存储库将更新为远程存储库。
提交您的更改,然后您可以将更改拉入您的分支
# add all the changes
git add .
git commit -m "Message"
# pull the changes which were added to the remote
git pull origin <branch name>
删除索引不起作用怎么办?
在这种情况下,你应该尝试重新克隆你的项目,一旦你有了它,将所需的更改文件复制到第二个克隆中,然后提交它们。