.git/FETCH_HEAD被写入空白内容

c86crjj0  于 2023-01-15  发布在  Git
关注(0)|答案(1)|浏览(134)

由于某些原因,.git/FETCH_HEAD文件总是空白的。

$ uname -v   
Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:54 PDT 2022; root:xnu-8792.41.9~2/RELEASE_X86_64
$ git --version
git version 2.37.1 (Apple Git-137.1)
$ git config --list
credential.helper=osxkeychain
init.defaultbranch=main
include.path=~/common/.gitconfig
core.excludesfile=/Users/khoan/.gitignore_global
user.name=Khoa Nguyen
user.email=khoa@nguyen.com
push.default=current
includeif.gitdir:~/srv/project/.path=~/srv/project/.gitconfig
user.email=khoa.nguyen@project.com
core.sshcommand=ssh -i ~/.ssh/project-id_ed25519
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=git@github.com:khoan/project.git
remote.origin.fetch=+refs/heads/main:refs/remotes/origin/main
$ git fetch origin feature-branch
Enter passphrase for key '/Users/khoan/.ssh/project-id_ed25519': 
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 7 (delta 4), reused 5 (delta 4), pack-reused 0
Unpacking objects: 100% (7/7), 2.90 KiB | 247.00 KiB/s, done.
From github.com:khoan/project
 * branch                    feature-branch -> FETCH_HEAD
$ wc .git/FETCH_HEAD
     0       0       0 .git/FETCH_HEAD

可能的原因和解决方法?谢谢。

dced5bon

dced5bon1#

我所知道的唯一一个不写FETCH_HEAD的示例是使用git fetch --no-write-fetch-head,这里不应该是这种情况。
因此,尝试并检查问题是否仍然存在于一个新的克隆,单独的文件夹,当提取在说新的克隆。只是为了排除一个进程,可能会保持句柄的文件,防止其更新。
OP Khoa Nguyen在备注中确认:
stat .git/FETCH_HEAD显示文件在git fetch origin main . T之后被修改

相关问题