无法使用 Windows Git Bash 将 50 MB 以下的压缩文件提交或推送到 GitHub
Unable to commit or push zipped files under 50 MB to GitHub using Windows Git Bash
我想在这里解决两个难题。第一个更为关键,是这里的最终问题。第二个在我的愿望清单上。
我将三个新文件添加到名为 test
的新存储库中。 test1.csv
(88,507 KB) 和 test2.txt
(330,854 KB)。还有一个非常小的文件。我叫了git add *
,然后我叫了git commit -m "comment"
,然后又叫了git push
。这引发了错误,表明文件大小太大。现在去掉两个大文件,留下第三个小文件。我确实添加、提交并再次推送。我得到了这个输出。奇怪的是我得到了最大尺寸的文件。 50 MB 和 100 MB。
当我单独压缩这些文件时,我可以得到非常小的文件大小。 test1.csv
压缩到 test1.zip
后变为 3,552 KB,test2.txt
压缩到 test2.zip
后变为 16,200 KB。即使在删除了这两个文件并添加了两个小压缩文件之后,我也得到了输出(如下)。所以它认为旧文件还在那里,也许吧?如何推送这些文件,以及第三个非常小的文件?
输出显示最大文件大小为 50 MB 和 100 MB。什么是正确的?
mac231@UH-WF-320-61 MINGW64 /c/git/test (master)
$ git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Counting objects: 19, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (15/15), done.
Writing objects: 100% (19/19), 37.45 MiB | 1.54 MiB/s, done.
Total 19 (delta 0), reused 0 (delta 0)
remote: warning: File RAW/private/test1.csv is 86.33 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: df96709b4791777b7cb9d64d19a61dab
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File RAW/private/test2.txt is 322.71 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/xxx/test.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/xxx/test.git'
mac231@UH-WF-320-61 MINGW64 /c/git/test (master)
$
这是 Git 版本,根据 Git Bash 命令提示:
$ git --version
git version 2.7.0.windows.1
编辑#1:
mac231@UH-WF-320-61 MINGW64 /c/git/test (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 4 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
最大尺码为100 MB
,推荐尺码为50 MB
.
错误信息:
remote: warning: File RAW/private/test1.csv is 86.33 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: df96709b4791777b7cb9d64d19a61dab
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File RAW/private/test2.txt is 322.71 MB; this exceeds GitHub's file size limit of 100.00 MB
似乎抱怨主要问题是 File RAW/private/test2.txt is 322.71 MB
。
添加文件时尝试使用 -u
选项,该选项会记录已删除文件的名称:
git add -u .
检查准备提交的内容:
git status
很遗憾我不得不求助于此作为 Git API 如此流行的版本控制系统的修复程序。或者是 GitHub 网站仍有一些重大问题需要修复。这不是世界上最好的解决方案,但它确实有效。而这也是由如此简单的工作流程造成的!
- 复制新文件
cd {path of 'test' parent folder}
- 已删除名为 'test'
的根文件夹
git clone https://github.com/{organization name}/test.git
- 将新文件移动到文件夹 test
cd {path of 'test'}
git add *
git commit -m "comment"
git push
我想在这里解决两个难题。第一个更为关键,是这里的最终问题。第二个在我的愿望清单上。
我将三个新文件添加到名为 test
的新存储库中。 test1.csv
(88,507 KB) 和 test2.txt
(330,854 KB)。还有一个非常小的文件。我叫了git add *
,然后我叫了git commit -m "comment"
,然后又叫了git push
。这引发了错误,表明文件大小太大。现在去掉两个大文件,留下第三个小文件。我确实添加、提交并再次推送。我得到了这个输出。奇怪的是我得到了最大尺寸的文件。 50 MB 和 100 MB。
当我单独压缩这些文件时,我可以得到非常小的文件大小。
test1.csv
压缩到test1.zip
后变为 3,552 KB,test2.txt
压缩到test2.zip
后变为 16,200 KB。即使在删除了这两个文件并添加了两个小压缩文件之后,我也得到了输出(如下)。所以它认为旧文件还在那里,也许吧?如何推送这些文件,以及第三个非常小的文件?输出显示最大文件大小为 50 MB 和 100 MB。什么是正确的?
mac231@UH-WF-320-61 MINGW64 /c/git/test (master) $ git push warning: push.default is unset; its implicit value has changed in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the traditional behavior, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple When push.default is set to 'matching', git will push local branches to the remote branches that already exist with the same name. Since Git 2.0, Git defaults to the more conservative 'simple' behavior, which only pushes the current branch to the corresponding remote branch that 'git pull' uses to update the current branch. See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Counting objects: 19, done. Delta compression using up to 8 threads. Compressing objects: 100% (15/15), done. Writing objects: 100% (19/19), 37.45 MiB | 1.54 MiB/s, done. Total 19 (delta 0), reused 0 (delta 0) remote: warning: File RAW/private/test1.csv is 86.33 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com. remote: error: Trace: df96709b4791777b7cb9d64d19a61dab remote: error: See http://git.io/iEPt8g for more information. remote: error: File RAW/private/test2.txt is 322.71 MB; this exceeds GitHub's file size limit of 100.00 MB To https://github.com/xxx/test.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://github.com/xxx/test.git' mac231@UH-WF-320-61 MINGW64 /c/git/test (master) $
这是 Git 版本,根据 Git Bash 命令提示:
$ git --version
git version 2.7.0.windows.1
编辑#1:
mac231@UH-WF-320-61 MINGW64 /c/git/test (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 4 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
最大尺码为100 MB
,推荐尺码为50 MB
.
错误信息:
remote: warning: File RAW/private/test1.csv is 86.33 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: df96709b4791777b7cb9d64d19a61dab
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File RAW/private/test2.txt is 322.71 MB; this exceeds GitHub's file size limit of 100.00 MB
似乎抱怨主要问题是 File RAW/private/test2.txt is 322.71 MB
。
添加文件时尝试使用 -u
选项,该选项会记录已删除文件的名称:
git add -u .
检查准备提交的内容:
git status
很遗憾我不得不求助于此作为 Git API 如此流行的版本控制系统的修复程序。或者是 GitHub 网站仍有一些重大问题需要修复。这不是世界上最好的解决方案,但它确实有效。而这也是由如此简单的工作流程造成的!
- 复制新文件
cd {path of 'test' parent folder}
- 已删除名为 'test' 的根文件夹
git clone https://github.com/{organization name}/test.git
- 将新文件移动到文件夹 test
cd {path of 'test'}
git add *
git commit -m "comment"
git push