Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
`Git`-update给出错误[.Git/index.lock';:文件存在。]_Git_Github_Git Commit - Fatal编程技术网

`Git`-update给出错误[.Git/index.lock';:文件存在。]

`Git`-update给出错误[.Git/index.lock';:文件存在。],git,github,git-commit,Git,Github,Git Commit,我的存储库在git中。在本地副本(我的系统)中,我对其中一个文件进行了一些更改 我尝试将该文件更新为git存储库。为此,我正在运行以下命令: git提交-一个“文本文件更新” 但我得到一个错误,如下所示: $ git commit -a fatal: Unable to create 'D:/Projects/gitProjects/color-palette/.git/index.lock': File exists. If no other git process is currently

我的存储库在
git
中。在本地副本(我的系统)中,我对其中一个文件进行了一些更改

我尝试将该文件更新为
git
存储库。为此,我正在运行以下命令:

git提交-一个“文本文件更新”

但我得到一个错误,如下所示:

$ 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提交-m“消息”
#拉取已添加到遥控器的更改
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提交-m“消息”
#拉取已添加到遥控器的更改
git拉原点

如果删除索引不起作用怎么办?
在这种情况下,您应该尝试重新克隆项目,并在克隆完成后将所需的更改文件复制到第二个克隆上,然后提交这些文件。

尝试将index.lock文件移动到存储库之外的位置,然后在
git
或本地计算机中再次尝试。你能解释一下这里到底出了什么问题吗?我猜锁文件已经损坏了。删除它(或者像我建议的那样为了备份和恢复而移动它)可能会解决这个问题https://github.com/3gwebtrain/color-palette-要删除的文件嵌套在何处?问题出在存储库的本地克隆中,而不是服务器上。锁定文件仅存在于本地驱动器中请尝试将index.lock文件移动到存储库之外的位置,然后在
git
或本地计算机中重试。你能解释一下这里到底出了什么问题吗?我猜锁文件已经损坏了。删除它(或者像我建议的那样为了备份和恢复而移动它)可能会解决这个问题https://github.com/3gwebtrain/color-palette-要删除的文件嵌套在何处?问题出在存储库的本地克隆中,而不是服务器上。锁定文件仅存在于本地驱动器中