1. 关于如何使用git推送大文件到github相关问题
如何使用vscode 推送大文件,首先当然安装github,其次安装git Large file storage:
https://git-lfs.github.com/
.gitignor设置无效的问题:
主要原因是.gitignor文件只会忽略未被tracking的文件,那么使用git rm --cache file然后git commit来释放该文件。释放整个文件夹的时候需要加一个参数-r ,git rm -r --cache directory/
https://stackoverflow.com/questions/6380196/gitignore-does-not-work
2. git 大文件管理操作方法
Lets take a look at the workflow when you need to check large files into your Git repository with Git LFS. For example, if you want to upload a very large file and check it into your Git repository:
Once a certain file extension is marked for tracking as a LFS object you can use Git as usual without having to redo the command to track a file with the same extension:
Make sure that .gitattributes is tracked by Git. Otherwise Git LFS will not be working properly for people cloning the project:
Cloning the repository works the same as before. Git automatically detects the LFS-tracked files and clones them via HTTP. If you performed the git clone command with a SSH URL, you have to enter your GitLab credentials for HTTP authentication.
If you already cloned the repository and you want to get the latest LFS object that are on the remote repository, eg. for a branch from origin:
https://docs.gitlab.com/ee/administration/lfs/manage_large_binaries_with_git_lfs.html#using-git-lfs
当本地仓库积攒了比较多版本的LFS导致体积较大的时候,可以通过以下命令进行清理:
git lfs prune
私有lfs仓库设置 .lfsconfig 配置文件,需要一并提交到 Git,否则Clone的时候不会去配置的地址上找
git config -f .lfsconfig lfs.url http://10.208.10.14:8080/repository/test01/
cat .lfsconfig
[lfs]
url = http://10.208.10.14:8080/repository/test01/
3. git commit大文件,不能push
git commit 超过仓库限制大小的大文件,导致不能push。
github或者码云,一般限制大小是100M,commit超过100M的文件会导致push失败。
解决办法有两个
执行后,看到追踪文件被重写,搞定,在进行push即可
4. Git@OSC 大于50M的文件不能上传么
上面的附件限制了50M,总容量100M。但是仓库中的文件大小是没有限制的。
所以上传的时候 不要把编译的文件也提交
5. Github如何上传超过100M的大文件
笔者我是在github上做了一个开源库( 一个灵活配置的自定义相机库(拍照+录制视频) )从而录制了一个大概200M+的gif文件,在commit完成了,push的时候 总是报错,大致信息如下:
或
上面错误的原因很好理解就是GitHub不允许直接上传大文件(超过100M)的文件到远程仓库,若要想继续提交可以尝试使用大文件支持库: https://git-lfs.github.com
LFS使用的简单步骤:
1-2步没变,第3步我是生成.gitattributes后 add并且commit并且把.gitattributes文件push到远程分支,合并完成后,然后再add并且commit然后再push这个大文件.
6. Git - push超大文件到远程仓库
项目中有视频文件,因为超过了50M,结果git提交,收到了警告提交失败
简单的说,github 会在你上传文件大于50M的时候,给予警告 ; 大于100M的时候给出 server reject(拒绝上传)
这还了得,必须解决他!!!
接着查资料,然后一顿操作,问题KO。
安装(在MAC上使用Homebrew安装)
选择您希望Git LFS管理的文件类型(或直接编辑.gitattributes)。您可以随时配置其他文件扩展名。这一步成功后会生成一个gitattributes文件
添加并commit .gitattributes文件
也可以手动添加如下:
然后再次提交
OK, KO,一分钟解决!!!
如果还没解决,遇到了报错信息是:
二进制文件较大,需要使用git lfs 提交,我本地已经安装了git lfs 。首先按照提示,执行:
取消远程仓库对LFS锁定的不支持。接下来解决认证失败的报错。x509很熟悉,是SSL传输的证书标准,应该是ssl认证失败,执行如下命令禁用SSL认证:
报错原因具体可以看这个官方issue: https://github.com/git-lfs/git-lfs/issues/2533
再尝试push到远程仓库: git push origin master
OK!问题解决。
点赞加关注,永远不迷路
参考git官方文档:
Git Large File Storage | Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.
7. Git上传文件及文件夹
最近做一批大麦转录组数据的分析,考虑到这个物种注释还不是很完善,所以自己做了一个orgdb的注释包,传到github上,供实验室的师弟和师妹用下。
第一个想到的就是git上传。
很早之前,就安装过git并绑定了github账号,但是一段时间不用,就忘记了。
所以记录下git建库及上传的过程。
首先进入到需要上传文件的项目文件夹里。(我自己建了个test文件夹)
(如果要上传文件,那么进入相应的文件夹里,上传,如果上传文件夹,可以直接在当前目录就行,我自己建了个test.txt文件)
8. gitlab 怎么修改单个文件大小
gitlab默认上传文件最大10M,如果大于10M,则需要做如下修改:
vim app/models/note.rb
找到如下行:validates :attachment, file_size: { maximum: 10.megabytes.to_i }
将10改为你想要的大小;
如果httpserver使用提nginx,则修改配置文件nginx.conf,在http中加入 client_max_body_size 50m, 这个值默认是1M。
此外,如果用eclipse的插件上传,报如下错:
Can't connect to any repository: http://10.210.92.69/bcop/bcop_si.git (An internal Exception occurred ring push: http://10.210.92.69/bcop/bcop_si.git: 411 Length Required)
做如下修改:
Eclipse>Preferences>Team>Git>Configuration>Add Entry
Enter http.postBuffer as key and 524288000 as value (if 500M is enough)
9. Git@OSC 大于50M的文件不能上传么
是的。
1、附件限制了50M,总容量100M。但是仓库中的文件大小是没有限制的。
2、一般来说记得不要把编译的文件也提交 ,这个大小足够了。
10. git 文件太大时怎样处理
1、先尝试用git log查看上次提交版本号,即哈希值。 2、通过git reset --hard空格加上哈希值前几位 自己多试几次吧。