gitlab:带有大型存储库的 git clone https 失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17826660/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
gitlab: git clone https with large repos fails
提问by mawl
When trying to clone a large repo (~700MB) over https, git fails with:
尝试通过 https 克隆大型 repo (~700MB) 时,git 失败:
c:\git-projects>git clone https://git.mycompany.de/fs.git
Cloning into 'fs'...
Username for 'https://git.mycompany.de': mwlo
Password for 'https://[email protected]':
efrror: RPC failed; result=22, HTTP code = 500
atal: The remote end hung up unexpectedly
clone over ssh works:
克隆通过 ssh 工作:
c:\git-projects>git clone [email protected]:fs.git
Cloning into 'fs'...
remote: Counting objects: 144564, done.
remote: Compressing objects: 100% (30842/30842), done.
remote: Total 144564 (delta 95360), reused 143746 (delta 94542)
Receiving objects: 100% (144564/144564), 601.34 MiB | 1.33 MiB/s, done.
Resolving deltas: 100% (95360/95360), done.
Checking out files: 100% (4649/4649), done.
Cloning smaller repositories with https also works:
使用 https 克隆较小的存储库也有效:
c:\git-projects>git clone https://git.mycompany.de/git-test.git
Cloning into 'git-test'...
remote: Counting objects: 135, done.
remote: Compressing objects: 100% (129/129), done.
remote: Total 135 (delta 68), reused 0 (delta 0)
Receiving objects: 100% (135/135), 18.77 KiB | 0 bytes/s, done.
Resolving deltas: 100% (68/68), done.
I have already tweaked some parameters but without success:
我已经调整了一些参数但没有成功:
/etc/nginx/nginx.conf
worker_processes 2; # have two cpu's
keepalive_timeout 120;
client_max_body_size 3072m;
/home/git/gitlab/config/gitlab.yml
## Git settings
# CAUTION!
# Use the default values unless you really know what you are doing
git:
bin_path: /usr/bin/git
# Max size of a git object (e.g. a commit), in bytes
# This value can be increased if you have very large commits
max_size: 3221225472 # 3072.megabytes
# Git timeout to read a commit, in seconds
timeout: 120
We would like to use git clone https, as the visual studio tools for git still not have implemented ssh.
我们想使用 git clone https,因为 git 的 Visual Studio 工具还没有实现 ssh。
On the server are two processes, CPU load goes to 100% after a while, then the processes are terminated.
服务器上有两个进程,CPU 负载在一段时间后达到 100%,然后进程终止。
git pack-objects --revs --all --stdout --progress --delta-base-offset
Regards, Marco
问候, 马可
System information
System: Debian 6.0.7
Current User: root
Using RVM: no
Ruby Version: 1.9.3p392
Gem Version: 1.8.23
Bundler Version:1.3.5
Rake Version: 10.0.4
GitLab information
Version: 5.3.0
Revision: 148eade
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: https://git.mycompany.de
HTTP Clone URL: https://git.mycompany.de/some-project.git
SSH Clone URL: [email protected]:some-project.git
Using LDAP: yes
Using Omniauth: no
GitLab Shell
Version: 1.4.0
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/bin/git
回答by VonC
This is reported in issue 3079: https cloning requires a large amount of resources (CPU, but mainly memory) on the GitLab server, and currently (GitLab 5.x) large repos.
这在问题 3079 中报告:https 克隆需要 GitLab 服务器上的大量资源(CPU,但主要是内存),并且当前 (GitLab 5.x) 大型存储库。
Even GitLab 6.0 comes with commits like 7ecebdd, mentioning timeouts when cloning largerepo.
甚至 GitLab 6.0 也带有7ecebdd 之类的提交,在克隆大型repo时提到了超时。
I haven't tested with GitLab 6, though (which should release tomorrow).
不过,我还没有用 GitLab 6 测试过(明天应该会发布)。
回答by mxmader
Consider implementing a chunking plugin for nginx, such as HttpChunkinModule.
考虑为 nginx 实现分块插件,例如HttpChunkinModule。
I personally haven't deployed the above but have a client with similar issues.
我个人还没有部署上述内容,但有一个有类似问题的客户。
In their case, the problem is on the client side, where we need to instruct devs to use the following tweak to their local git config:
在他们的情况下,问题出在客户端,我们需要指示开发人员对他们的本地 git 配置使用以下调整:
git config http.postBuffer 524288000 #Set to 500MB
git config http.postBuffer 524288000 #设置为500MB
The above will simply allow larger git-related http requests on the client side (we've got plenty of memory on the server side).
上面的代码只会在客户端允许更大的与 git 相关的 http 请求(我们在服务器端有足够的内存)。