[英]I've updated Git and 'lost my Head', so now I can't commit
I recently downloaded git 2.19.0.windows.1.我最近下载了 git 2.19.0.windows.1。 In the previous versions of git, I could git clone and git commit from/to both my local drive and my H drive.
在以前的 git 版本中,我可以 git clone 和 git commit 从/到我的本地驱动器和我的 H 驱动器。 Now with this version of git, I can only git clone and commit on my local drive but not on my H drive.
现在使用这个版本的 git,我只能在本地驱动器上执行 git clone 和 commit,而不能在我的 H 驱动器上执行。 When I commit on my H drive I get the following error:
当我在 H 驱动器上提交时,出现以下错误:
fatal: cannot update the ref 'HEAD': unable to append to '.git/logs/HEAD': Bad file descriptor
I have tried to find my head using the following code:我试图使用以下代码找到我的头:
$ echo ref: refs/head/master >.git/HEAD
This does not work, I don't know what the next move is.这行不通,我不知道下一步是什么。
Check first what git status
and git config -l
when done in your repository on H:\\
: when in doubt (in an IDE), fall back to the command line.在
H:\\
上的存储库中完成后,首先检查git status
和git config -l
:如果有疑问(在 IDE 中),请回退到命令行。
As mentioned here , a branch yet to be born generally means an new empty repo where at least one commit is needed.正如这里提到的,一个尚未诞生的分支通常意味着一个新的空仓库,其中至少需要一次提交。
That or, as illustrated there :或者,如图所示:
GIT_WORK_TREE
or GIT_DIR
set referencing another repoGIT_WORK_TREE
或GIT_DIR
集I had the same issue recently.我最近遇到了同样的问题。 I am not sure of the root cause at this time, but I deleted the
.git/logs/HEAD
folder and then the commit went through just fine.我现在不确定根本原因,但我删除了
.git/logs/HEAD
文件夹,然后提交就顺利完成了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.