Git LFS使用遇到的问题

1. this exceeds GitHub’s file size limit of 100.00MB

对于大型文件的版本控制,我按照https://git-lfs.github.com/ 操作后,还是提示下图error:

image-20210521163920147

接着我运行命令git lfs track ,该命令的作用是显示 Git LFS 当前正在跟踪的所有模式的列表(以及它们在其中定义的.gitattributes 文件)。

果然这个路径是不对的,而且多出了 [[:space:]]

解决

  1. 可以直接删除 .gitattributes文件或使用 git lfs untrack path不跟踪指定大文件。

  2. 重新执行 git lfs track EzvizLIB/libEZOpenSDK.a跟踪该文件。

  3. 再次查看跟踪文件列表。

    image-20210521181718490

  4. 再次push,问题解决。

2. clone下拉又LFS跟踪的文件大小只有134字节

通过搜索得知:

在安装 Git LFS 之前,克隆了使用 Git LFS 的仓库,则被 Git LFS 管理的文件会被显示为文本指针,而非具体的文件。
查看这些文件指针,会发现类似如下内容
version https://git-lfs.github.com/spec/v1
oid sha256:4b99dbe6fe6f646b2026de93481045bbf34f995559db15fce34d192f1f320ef4
size 156154
解决办法就是,手动执行获取 Git LFS 对象的命令:
git lfs fetch
git lfs checkout
# 或
git lfs pull

解决

  1. 在一篇文章 https://zzz.buzz/zh/2016/04/19/the-guide-to-git-lfs/找到可疑方法,如下图所示:

  1. 于是执行如下命令:

    1
    git lfs pull

    执行后提示如下:

  2. 根据上一步提示,很明显没有安装lfs。从 https://git-lfs.github.com/binary packages 下载二进制包,下载解压后,执行 .install.sh安装lfs。

  3. 再次执行 sudo git lfs pull (不加sudo,会提示无权限),提示如下图所示:

  4. fetch失败,我想应该是网络问题,于是给终端添加代理后(注意添加后sudo命令默认是不会走代理的,因此你还需要让sudo命令走代理,方法自行搜索),再次执行 sudo git lfs pull 还是提示上图的错误。执行不带sudo的 git lfs pull 却能下载成功,但是提示 permission denied :

  5. 于是尝试重新clone却可以了。

3. 收到 At 80% of Git LFS data quota for GanZhiXiong这样的邮箱

邮箱内容为:

We wanted to let you know that you’ve used 80% of your data plan for Git LFS on your personal account GanZhiXiong. No immediate action is necessary, but you might want to consider purchasing additional data packs to cover your bandwidth and storage usage:

https://github.com/account/billing/data/upgrade

Current usage as of 21 May 2021 09:54AM UTC:

Bandwidth: 0.89 GB / 1 GB (89%)
Storage: 0.22 GB / 1 GB (22%)

翻译过来为:

谨在此告知您,您的个人帐户GanZhiXiong已将80%的数据计划用于Git LFS。 无需立即采取措施,但是您可能要考虑购买其他数据包来覆盖您的带宽和存储使用情况:

https://github.com/account/billing/data/upgrade

截至2021年5月21日UTC的当前使用情况:

带宽:0.89 GB / 1 GB(89%)

储存空间:0.22 GB / 1 GB(22%)

你可以在 https://github.com/settings/billing 此页查看到LFS的可用存储空间和带宽:

image-20210522170420253

通过 https://docs.github.com/cn/github/managing-large-files/versioning-large-files/about-storage-and-bandwidth-usage 此页可以得知GitHub为每个使用 Git Large File Storage 的帐户都会获得 1 GB 的免费存储空间和一个月的免费带宽 1 GB。 如果带宽和存储配额不够,您可以选择为 Git LFS 购买额外配额。

你可以 https://github.com/account/billing/data/upgrade 此页购买Git LFS额外配额。

Git LFS使用遇到的问题

https://ganzhixiong.com/p/448598ca/

Author

干志雄

Posted on

2019-05-14

Updated on

2019-05-14

Licensed under

Comments