【问题标题】:Push very large repo to gitlab server将非常大的 repo 推送到 gitlab 服务器
【发布时间】:2015-12-04 19:45:58
【问题描述】:

我有一个非常大的仓库(> 1GB,因为二进制资产),gitlab 服务器安装正确(医生报告一切正常),我创建了一个工作正常的小 git 仓库,推拉等等。

Username for 'http://x.y.z': tyoc213 Password for 'http://tyoc213@x.y.z': Counting objects: 4894, done. Compressing objects: 100% (4872/4872), done. error: RPC failed; result=55, HTTP code = 0 fatal: The remote end hung up unexpectedly Writing objects: 100% (4894/4894), 506.89 MiB | 12.27 MiB/s, done. Total 4894 (delta 2104), reused 0 (delta 0) fatal: The remote end hung up unexpectedly Everything up-to-date

我已尝试将git config http.postBuffer 5000 更改为更大。

我什至尝试将它从服务器内部(我的意思是服务器内部已经有 git repo)推送到 gitlab,但同样的错误发生了。

有解决办法吗?我应该尝试什么?怎么会是“最新的”?

【问题讨论】:

  • 请先分享你的Nginx配置文件。什么是独角兽超时?

标签: git nginx gitlab


【解决方案1】:

我在上传 4 GB 存储库时遇到了同样的问题。 我编写了这个 bat 脚本来按文件类型分阶段推送 repo。这个使 推得更快。

适用于 Linux

git add **/*.$1
git commit -m "$1"
git push

对于 Windows

set ext=%1
git add **/*.%ext%
git commit -m "%ext%"
git push

上传我要使用的所有.js 文件

>>> this.bat js

【讨论】:

    【解决方案2】:

    使用非常大的存储库时的另一个选择是分阶段推送它。有一个 Amazon AWS CodeCommit 示例脚本,它创建标签(将存储库批处理到每 X # 次提交中),然后在标签之间推送提交。

    位于: http://docs.aws.amazon.com/codecommit/latest/userguide/how-to-push-large-repositories.html#how-to-push-large-repositories-sample

    此网址还有其他一些选项,包括在推送之前使用git gc --aggressive 来减小存储库的大小:

    Git, fatal: The remote end hung up unexpectedly

    【讨论】:

      【解决方案3】:

      我刚刚遇到了类似的问题,即使 git config 也无法解决。您可能想改为使用 ssh。

      如果您使用的是 sourcetree,您可以执行以下操作。

      1. 创建一个 ssh 密钥并将其导入您的 gitlab 帐户 https://gitlab.com/help/ssh/README

      2. 在 SourceTree > 工具 > 添加 SSH 密钥 > 选择您在本地创建的 ssh (id_rsa.pub)

      3. 转到您正在处理的 Repo > 设置(右上角)

      4. 在远程选项卡下 > 添加 > 输入名称和您的 ssh 链接 (git@gitlab.com:xxxxxxxxxx/xxxxxxxxx.git)

      5. 一旦添加了新的远程仓库,就会出现,然后右键单击并获取仓库

      6. 现在您可以使用 ssh 推送到 repo

      之后你可以删除 https 远程仓库

      【讨论】:

        【解决方案4】:

        检查您的config/unicorn.rb config

        它包括:

        # nuke workers after 30 seconds instead of 60 seconds (the default)
        #
        # NOTICE: git push over http depends on this value.
        # If you want be able to push huge amount of data to git repository over http
        # you will have to increase this value too.
        #
        # Example of output if you try to push 1GB repo to GitLab over http.
        #   -> git push http://gitlab.... master
        #
        #   error: RPC failed; result=18, HTTP code = 200
        #   fatal: The remote end hung up unexpectedly
        #   fatal: The remote end hung up unexpectedly
        

        这不是完全相同的错误,但问题可能是相关的。
        Check your unicorn logs

        对于“RPC failed; result=55”,请参阅my old answer,并尝试提高日志级别(GIT_CURL_VERBOSE=1 git push,请参阅this example)和/或切换到 ssh 以测试问题是否仍然存在。

        如果您在 unicor 日志中看不到任何内容,则表示从未访问过 Gitlab。
        如果你前面有 NGiNX,常见的问题是its config for allowing large files。寻找 client_max_body_size xxM;,并增加该值。

        【讨论】:

          猜你喜欢
          • 2013-06-04
          • 2013-03-10
          • 2017-02-15
          • 1970-01-01
          • 2017-11-17
          • 2014-02-02
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多