項(xiàng)目集成谷歌的VR SDK后, 提交到github的時候發(fā)現(xiàn)報(bào)錯
The push operation includes a file which exceeds GitHub’s file size restriction of 100MB. Please remove the file from history and try again.
谷歌了一番, 有以下兩個解決方案:
方案一
這個方案適用于僅最近的一次提交包含大于100MB的文件, 解決起來也比較簡單.
官網(wǎng)解決流程
git rm --cached giant_file
# Stage our giant file for removal, but leave it on disk
git commit --amend -CHEAD
# Amend the previous commit with your change
# Simply making a new commit won't work, as you need
# to remove the file from the unpushed history as well
git push
# Push our rewritten, smaller commit
方案二
這個方案適用于多次的commit已經(jīng)包含大于100MB的文件, 所以需要對之前的dirty commits進(jìn)行處理, 這里官網(wǎng)就推薦使用BFG.
- 下載BFG
# Open Terminal using Spotlight search by pressing <command+space>. Type terminal and hit Enter key.
# Now, Execute
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
# Install bfg using brew
# 執(zhí)行這句的時候可能會提示需要Java環(huán)境, 按照提示下載Java環(huán)境后在執(zhí)行brew install bfg即可
brew install bfg
- 使用BFG
# <bfg.jar>指的是你下載bfg.jar的路徑
# <.git>指的是你倉庫的路徑
java -jar <bfg.jar> --no-blob-protection --strip-blobs-bigger-than 50M <.git>
# example: java -jar /Users/Li/Desktop/bfg/bfg-1.12.16.jar --no-blob-protection --strip-blobs-bigger-than 50M /Users/Li/Desktop/iOS
# 找到大文件后再輸入
git reflog expire --expire=now --all && git gc --prune=now --aggressive
#then
git push origin master
succees!