【问题标题】:error: cannot open .git/FETCH_HEAD: Invalid argument错误:无法打开 .git/FETCH_HEAD:参数无效
【发布时间】:2015-06-03 02:06:54
【问题描述】:

我正在使用 Git(来自 GitHub for Windows 发行版)并尝试从我的存储库中提取,但出现以下错误:

D:\Code\dopey-weaver [master]> git fetch
error: cannot open .git/FETCH_HEAD: Invalid argument

D:\Code\dopey-weaver [master]> git fetch --verbose
error: cannot open .git/FETCH_HEAD: Invalid argument

这不是许多其他问题的“权限被拒绝”,所以看起来我是一个特殊的雪花......我可以打开.git/FETCH_HEAD,它看起来很好(?):

010779f14f5bdf1d2d806a0ce0ac4c5e50314186        branch 'master' of https://github.com/nicktimko/dopey-weaver

我认为我与遥控器上的内容有些冲突,所以我应该拉/合并,但我什至无法获取开始...推送时的错误消息看起来有点长(这相当于hg 用不多的话说“这会产生多个头”?)

D:\Code\dopey-weaver [master]> git push
To https://github.com/nicktimko/dopey-weaver.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/nicktimko/dopey-weaver.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

【问题讨论】:

  • 可以试试strace git fetch
  • --verbose 在 Ubuntu 版本的 git 中不是一个选项。你确定它在 Windows 下受支持吗?
  • @StevenPenny 它给出了完全相同的错误,我只是想让它可能吐出更多东西。 --verbose 在手册页中显示为一个选项
  • @NickT 重点不是要消除错误,重点是您可以诊断错误。如果你不知道它的作用,你应该查找 strace
  • @StevenPenny 哦,我的意思是有和没有-v。有没有简单的strace for Windows?我可以试试进程监视器...

标签: windows git


【解决方案1】:

问题似乎是因为卷(exFAT 驱动器)脏了,因此是只读的,需要通过chkdsk 运行。所以,要解决:

  1. 以提升模式启动 PowerShell/CMD(简单的方法是右键单击“开始”菜单中的快捷方式并选择“以管理员身份运行”)
  2. 在所需的卷上运行 chkdsk,例如chkdsk D: /X (/X 强制下马)
    • 如果您在主分区 (C:) 上遇到此问题,您可能必须在启动时执行 chkdsk...不知何故。

【讨论】:

    猜你喜欢
    • 2015-05-18
    • 2015-11-29
    • 2012-10-23
    • 2019-11-09
    • 2015-09-21
    • 2016-11-15
    • 2013-04-25
    • 1970-01-01
    • 2017-11-20
    相关资源
    最近更新 更多