git pull 在拉取 lfs 文件时失败

huangapple go评论61阅读模式
英文:

git pull fails when pulling lfs file

问题

我遇到了授权错误和“smudge filter”错误,当我从我的公开可见的存储库中进行git拉取时。错误发生在下载由git lfs指向的文件时。我的存储库看起来像这样:

文件夹
文件夹
.gitattributes
Python文件
big_binary_file.h5

我收到的错误如下:

下载 big_binary_file.h5(262 MB)
下载对象时出错:big_binary_file.h5:Smudge错误:下载big_binary_file.h5时出错:
批处理响应:授权错误:https://github.com/user/repo.git/objects/batch
确保您对存储库具有适当的访问权限

错误已记录到log_path/log.log
使用 `git lfs logs last` 查看日志。
错误:外部过滤器 'git-lfs filter-process' 失败
致命错误:big_binary_file.h5:smudge 过滤器 lfs 失败

我不认为我有任何授权问题,因为我的存储库中的其他文件可以顺利拉取。我的存储库是公开的,git lfs 文件不应该需要任何特殊的授权,对吗?

我的 .gitattrbutes 正确地标识出 '.h5' 文件应使用 LFS 进行提取。它看起来像这样:

*.h5 filter=lfs diff=lfs merge=lfs -text

有没有人在进行git拉取时遇到类似的错误,他们能否解释我错在哪里或可能是什么原因?

这是我尝试过的事情(如果你遇到此问题,也可以尝试):

我的 lfs.urlremote.origin.url 相同

  • 我查看了我的 git 凭据 确保它们设置正确。
  • 我验证了我的存储库是否对公众可见,并确保我的 .gitattributes 设置正确。
  • 我确保在我的系统上设置了 git lfs 并已将其用于推送到同一存储库。
  • 我尝试诊断 git lfs logs last
  • 我尝试使用 git reset 然后拉取。
英文:

I'm getting an Authorization error and a 'smudge filter' error when I git pull from my publicly-visible repo. The error occurs when downloading a file that is pointed to by git lfs. My repo looks like this:

folder
folder
.gitattributes
python file
big_binary_file.h5

The error I get looks like this:

Downloading big_binary_file.h5 (262 MB)
Error downloading object: big_binary_file.h5: Smudge error: Error downloading big_binary_file.h5:
batch response: Authorization error: https://github.com/user/repo.git/objects/batch
Check that you have proper access to the repository

Errors logged to log_path/log.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: big_binary_file.h5: smudge filter lfs failed

I don't believe I have any authorization issues because the other files from my repo pull seamlessly. My repo is public and a git lfs file shouldn't have any special authorization needed, right?

My .gitattrbutes correctly identifies that '.h5' files should be fetched using LFS. It looks like this:

*.h5 filter=lfs diff=lfs merge=lfs -text

Has anyone gotten a similar error when they git pull and can they shine light on where I went wrong or what might be the cause of this?

Here are things I've tried (and you might try to if you run into this page looking for advice:)

My lfs.url is the same as remote.origin.url

  • I've looked at my git credentials to make sure they are set correctly.
  • I've verified that my repo is publicly visible and that my .gitattributes is setup correctly.
  • I've made sure git lfs is setup on my system and have used it to push to the same repo.
  • I've tried diagnosing git lfs logs last.
  • I tried using git reset and then pulling.

答案1

得分: 0

你的 lfs.url 不应与你的 remote.origin.url 相同。如果你不需要一个与常规 Git 远程不同的 LFS 远程,你应该省略 lfs.url 配置设置,让 Git LFS 自动发现它。

否则,通常你的 lfs.url 应该以 /info/lfs 结尾。因此,https://github.com/user/repo.git/info/lfs 将是正确的选项。

英文:

Your lfs.url should not be the same as your remote.origin.url. If you don't need a different LFS remote than your regular Git remote, you should omit the lfs.url configuration setting and let Git LFS autodiscover it.

Otherwise, typically your lfs.url is supposed to end with /info/lfs. Thus, https://github.com/user/repo.git/info/lfs would be the right option.

huangapple
  • 本文由 发表于 2023年6月6日 14:03:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76411811.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定