简体   繁体   English

如何将大文件添加到 Git 存储库?

[英]How can I add large files to a Git repo?

I have a Microsoft Azure / Visual studio online repo managed with Git.我有一个使用 Git 管理的 Microsoft Azure / Visual Studio 在线存储库。 I am using the Git GUI application to manage it.我正在使用 Git GUI 应用程序来管理它。

I have a couple of files that are 535 MB and 620 MB in size.我有几个大小为 535 MB 和 620 MB 的文件。 I would like to add these to the repo.我想将这些添加到回购中。

I have enabled Git large file support, and i have set the global post buffer with the command:我启用了 Git 大文件支持,并使用以下命令设置了全局后缓冲区:

git config --global http.postBuffer 1048576000

No matter what I do, I cannot seem to add these files.无论我做什么,我似乎都无法添加这些文件。 The commit is fine, but when I push to the remote branch, I get:提交很好,但是当我推送到远程分支时,我得到:

POST git-receive-pack (547584390 bytes)
error: RPC failed; HTTP 503 curl 22 The requested URL returned error: 503
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Everything up-to-date

As far as I know, adjusting the buffer like this should work in this case.据我所知,在这种情况下,像这样调整缓冲区应该可以工作。 What am I missing?我错过了什么?

Activating LFS locally ( git-lfs.github.com as you mention) is a good first step.在本地激活 LFS( git-lfs.github.com正如你所提到的)是一个很好的第一步。

Check also the prerequisites and limitations at Azure DevOps Azure Repos / Use Git Large File Storage (LFS)还要检查Azure DevOps Azure 存储库/使用 Git 大文件存储 (LFS)中的先决条件和限制

Finally, if you just added/committed the large file, it is better to reset that commit (assuming you don't have any other work in progress), and then track it through lfs :最后,如果您刚刚添加/提交了大文件,最好重置该提交(假设您没有任何其他工作正在进行),然后通过 lfs 跟踪它

git reset @~
git lfs track lyLargeFile
git 

After fighting with git for weeks, I have finally solved this.在与 git 斗争了数周后,我终于解决了这个问题。

the answer for me was to clone the repo again using SSH instead of HTTP.我的答案是使用 SSH 而不是 HTTP 再次克隆 repo。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM