github - 致命的 : cannot update the ref 'HEAD' : unable to append to '.git/logs/HEAD' : Bad file descriptor

标签 github git-commit git

我正在从事机器人框架自动化项目。突然间 git commit 不起作用我在提交命令时遇到以下错误

**fatal: cannot update the ref 'HEAD': unable to append to '.git/logs/HEAD': Bad file descriptor**

我在 Windows 机器上工作。到目前为止,我已经完成了 4 次提交,代码在 Repo 中。通过最新的更改,提交不会发生上述错误我已经解决了堆栈溢出中引用的几个问题,但我可以解决它。

请帮助我解决这个问题

我使用命令 git commit -a -m "description"git commit -m "description"
它说 sudo 命令对我都不起作用
> $ sudo chown -R useremail .git/ 
> bash: sudo: command not found

最佳答案

当您不小心创建了具有 root 权限的分支时,就会发生这种情况。最好在本地检查 .git 的所有权权限,即 ls -la .git/refs/heads/应该归用户所有,而不是 root。

关于github - 致命的 : cannot update the ref 'HEAD' : unable to append to '.git/logs/HEAD' : Bad file descriptor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53223725/

相关文章:

git - 在 Git 中,如何 rebase + 压缩历史记录中具有多个 merge 提交的分支,而不选择一个全新的分支

Git 标签列表,显示提交的 sha1 哈希值

git - “git apply”失败,代码为 1 : trailing whitespace in SourceTree

git rebase --continue 与新提交

logic - git 逻辑缺失

git - 使用 Github CLI 克隆存储库是使用 HTTPS 还是 SSH?

git - 限制某些 GitHub 用户 merge 分支

git - 如何删除已删除的 git 子树文件夹的历史记录?

git - 如何编写好的 Git 提交信息?

r - GitHub 显示来自 README.rmd 的所有代码块(尽管 include=FALSE)