如何从标签或发行版中以git lfs文件(原始文件而非文件指针)的源代码形式下载. [英] How to get git lfs files (original files not file pointers) from download as source code.zip from tags or releases?

查看:347
本文介绍了如何从标签或发行版中以git lfs文件(原始文件而非文件指针)的源代码形式下载.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我标记提交时,我将从github.com/user/project/release下载所有LFS文件(原始文件)而不是文件指针(每个文件大约1kb)

When I tag the commit then I download from github.com/user/project/releases all LFS file is not coming (original files) but only the file pointers (around 1kb per file)

我尝试调用"git lfs fetch"是绝对不起作用的,因为zip中没有附带".git"文件夹

I tried to call "git lfs fetch" is absolute doesn't work because '.git' folder is not coming with the zip

$ git lfs fetch
Not in a git repository.

当我通过github.com/user/project/releases下载标签时,它应该是该标签中的所有原始文件.

When I download the tag through the github.com/user/project/releases it should be the all original file from that tag.

我错过了什么吗?我试图在Google上进行搜索,但没有找到我的问题.

Did I miss something? I tried to search at Google but not found my question.

推荐答案

GitHub并未提供使用可下载档案获取LFS文件的方法.有些项目包括包含LFS文件的自己的tarball,如果是这样,则可以使用其中的一个tarball.

GitHub doesn't provide a way to get the LFS files using the downloadable archives. Some projects include their own tarballs that contains the LFS files, and if so, you can use one of those tarballs.

否则,您可以执行以下操作来获取LFS文件(在这种情况下,例如v1.0.0上的/project):

Otherwise, you can do something like the following to get the LFS files (in this case, for example/project at v1.0.0):

git clone -b v1.0.0 --depth 1 https://github.com/example/project.git project
git -C project archive --format=zip --prefix=project-1.0.0/ HEAD >project-1.0.0.zip

请注意,如果您要下载多个档案,最好克隆整个存储库,而不要像上面那样使用浅层克隆.

Note that if you're trying to download multiple archives, it will be better to clone the entire repo instead of using a shallow clone as I did above.

这篇关于如何从标签或发行版中以git lfs文件(原始文件而非文件指针)的源代码形式下载.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆