使用Git Large File Storage突破GitHub单文件100M上传限制


问题描述

在GitHub push过程中发现下图问题

大致意思是有某个单文件大小超过了100M,GitHub做出了限制,需要用git lfs即Git Large File Storage来解决

解决

  1. 安装git lfs

  2. 在需要push的文件夹的上运行git,并输入

git lfs install
  1. 选定文件(也就是那个大于100M的单文件)

*.db 只是示例,这里指代所有以 db 为结尾的数据库文件,具体视情况而定

git lfs track "*.db"

此时会在目录下生成 .gitattributes 文件

刚才通过 git lfs track “*.db” 命令添加的配置也写在了.gitattributes了,这边也可以再次更改

  1. 重新 add commit push
  • 我这边时第一次提交时还是报错了,将 .git 文件删除后才成功的
  1. 根据其他人的经验:GitHub会给予用户大文件存储1G的免费空间,在 Setting -> Billin&plan 可见。不过我看了一哈,好像没被扣。是我看错了?还是暂未生效呢?还是巨硬又给福利了(2020年12月17日)?

哈哈并没有 (2021年07月18日),还想薅资本主义羊毛?

其他问题

  • the remote end hung up unexpectedly
the remote end hung up unexpectedly

则需要修改 postBuffer 的大小,这边修改了为512M

git config --local http.postBuffer 536870912

也可已在 .git 文件夹下的 .config 中修改,新增如下命令

[http]
	postBuffer = 536870912
  • Filename too long

文件名太长了

git config --system core.longpaths true

如果还有其他的莫名奇妙的 ssl连接超时403 时就要上 配钥匙大法

http

git config --global http.proxy 127.0.0.1:1081

https

git config --global https.proxy 127.0.0.1:1081

socks5

git config --global http.proxy socks5://127.0.0.1:1080

git config --global https.proxy socks5://127.0.0.1:1080

取消代理

git config --global --unset http.proxy

git config --global --unset https.proxy

文章作者: PudgeLee
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 PudgeLee !
评论