A. 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.