获取git LFS文件时出错:服务器上不存在对象:[404]服务器上不存在对象

时间:2020-07-11 18:02:27

标签: git github git-lfs

我下载并安装了Git Large File Storage。现在,我试图从github中的现有存储库(不是我的)中获取lfs文件。 我尝试过:

git lfs clone https://github.com/MKnoche/wiki_bias_embedding

然后在我本地刚刚克隆的仓库中:

git lfs fetch --all

git lfs pull

我也尝试过相同的操作,但是没有“ lfs”。

克隆了存储库,但对于所有lfs文件,始终显示此错误:

[301582dabd8c6ac7bdf626c7e4a1d64c8f9665b65b6334b44642bdfb78054575] Object does not exist on the server: [404] Object does not exist on the server

然后:

error: failed to fetch some objects from 'https://github.com/MKnoche/wiki_bias_embedding.git/info/lfs'

因此,克隆了可以在GitHub本身中看到的小指针,而不是真正的大文件。

与此同时,该命令:

git log --all -p -S 301582dabd8c6ac7bdf626c7e4a1d64c8f9665b65b6334b44642bdfb78054575

给出以下结果:

commit 36c7dba69de90d99f0c305fce13a598b8f06b443
Author: Markus Knoche <knoche.markus@googlemail.com>
Date:   Wed Sep 11 18:01:25 2019 +0200 
Add embeddings 
diff --git a/embeddings/wikipedia/0.pkl b/embeddings/wikipedia/0.pkl
new file mode 100644
index 0000000..5ee94da
--- /dev/null
+++ b/embeddings/wikipedia/0.pkl
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:301582dabd8c6ac7bdf626c7e4a1d64c8f9665b65b6334b44642bdfb78054575
+size 588838774

我对GitHub的使用不是很自信,尤其是LFS。所以,问题是:我是在做错什么,还是确实意味着服务器上不存在这些文件?

2 个答案:

答案 0 :(得分:3)

此错误消息是HTTP 404找不到错误。从本质上讲,这意味着Git LFS尝试拉低文件,但该文件不存在。用户很可能没有正确上传它,可能是因为他们没有运行git lfs install。如果他们运行了该命令,则在上载Git对象之前,安装在其存储库中的pre-push钩子会将文件推送到服务器。

由于未上传文件,因此您无法下载它们。您必须要求作者在其存储库中运行git lfs push --all才能将其上传到正确的位置,以便可以下载。

答案 1 :(得分:0)

如果要从一个GIT存储库迁移到另一个GIT存储库,则需要从源存储库获取完整的LFS历史记录,并将完整的LFS历史记录推入新的(空)目标存储库,以避免丢失lfs objs。我从源存储库迁移到目标存储库的步骤:

从源存储库克隆并下载完整的LFS历史记录

git clone http://source... local_src
cd local_src
git lfs fetch --all

推送到新的目标存储库并上传完整的LFS历史记录

git remote set-url origin https://target...
git push --mirror origin
git lfs push origin --all