當前位置:首頁 » 文件管理 » git可以傳大文件嗎
擴展閱讀
新環境怎樣調整心態 2025-05-20 11:42:41
超市有什麼奶貓咪可以喝 2025-05-20 11:32:00

git可以傳大文件嗎

發布時間: 2022-12-22 09:29:51

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空格加上哈希值前幾位 自己多試幾次吧。