我有一个本地存储库,其中意外添加了一个大文件。现在我落后了近 100 个提交。当我尝试推送到 GitHub 时,出现错误。
我需要帮助做任何我需要做的事情才能推送这个存储库的其余部分。
我不需要这个文件,可以永久删除它
(旁注:这是一个包含 IPython 节点和代码的目录。我有一个脚本自动推送它,这就是为什么我落后了近 100 次提交。我只是注意到它没有同步)
这是我尝试过但没有成功的方法:
git status
在分支主控上
您的分支比“origin/master”领先 100 次提交。
(使用“git push”发布您的本地提交)
无需提交任何内容,工作目录干净
git filter-branch --index-filter 'git rm --cached --ignore-unmatch "Education/Coursera/Exploratory Data Analysis/Week1/household_power_consumption.txt"' --tag-name-filter cat -- --all
重写 d381c7d5037a6a26abb2b5cef06e57d8b86a398b (95/189)rm '教育/Coursera/探索性数据分析/Week1/household_power_conspiration.txt'
..
重写 f639b57714a5d57ff37b9d4a55c1c69fc0b514a8 (176/189)rm '教育/Coursera/探索性数据分析/Week1/household_power_conspiration.txt'
重写 587c8b65f19315ebeb6627a75bd703a5dbdec208 (189/189)
参考'refs/heads/master'被重写
警告:参考“refs/remotes/origin/master”未更改
git rm "Education/Coursera/Exploratory Data Analysis/Week1/household_power_consumption.txt"
致命:pathspec 'Education/Coursera/Exploratory Data Analysis/Week1/household_power_conspiration.txt' 与任何文件都不匹配
git push
警告:push.default 未设置;它的隐含值在 Git 2.0 中从“匹配”变为“简单”。要抑制此消息并在默认更改后保持当前行为,请使用:
git config --global push.default matching
要压制此消息并立即采用新行为,请使用:
git config --global push.default simple
当push.default设置为“匹配”时,git会将本地分支推送到已存在的同名远程分支。
在 Git 2.0 中,Git 默认采用更保守的“简单”行为,即仅将当前分支推送到“git pull”用于更新当前分支的相应远程分支。
请参阅“git help config”并搜索“push.default”以获取更多信息。
(“简单”模式是在 Git 1.7.11 中引入的。如果您有时使用旧版本的 Git,请使用类似的模式“当前”而不是“简单”)
数物体:841,完成。
增量压缩最多使用 2 个线程。
压缩对象:100% (578/578),完成。
写入对象:100% (835/835),31.79 MiB | 3.14 MiB/s,完成。
总计 835(增量 196),重复使用 0(增量 0)
远程:警告:文件 .git-rewrite/t/Education/Coursera/Exploratory Data Analysis/Week1/household_power_conspiration.txt 为 74.92 MB;这大于 GitHub 建议的最大文件大小 50.00 MB
远程:警告:文件 .git-rewrite/t/Education/Coursera/Exploratory Data Analysis/Week1/household_power_conspiration.txt 为 69.38 MB;这大于 GitHub 建议的最大文件大小 50.00 MB
远程:错误:GH001:检测到大文件。
远程:错误:跟踪:f013f5e75b4f35d07de5d2d9ef1116bd
远程:错误:参见http://git.io/iEPt8g了解更多信息。
远程:错误:文件 .git-rewrite/t/Education/Coursera/Exploratory Data Analysis/Week1/household_power_conspiration.txt 为 126.80 MB;这超出了 GitHub 的文件大小限制 100.00 MB
To [电子邮件受保护]:rbohac/IPython-Notebooks.git
! [远程拒绝] master -> master(预接收挂钩被拒绝)
错误:无法将一些参考推送到'[电子邮件受保护]:rbohac/IPython-Notebooks.git'