Git 克隆太慢了

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15754335/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 15:54:01  来源:igfitidea点击:

Git Clone is too slow

gittortoisegitgit-clonegit-bashgit-commands

提问by alvin

This is my first time to construct the git server. When I use TortoiseGit-1.8.1.0-32bit to handle the operation, everything is fine!

这是我第一次搭建git服务器。当我使用 TortoiseGit-1.8.1.0-32bit 处理操作时,一切正常!

But if i use the git clonecommand or git bash, the git clone process speed is so slow. I've attached two images showing the relative git clonetransfer speeds below.

但是如果我使用git clone命令或 git bash,git clone 进程速度会很慢。我附上了两张图片,显示了git clone下面的相对传输速度。

Can anybody give me some suggestions?

有人能给我一些建议吗?

Cloning via TortoiseGit

通过 TortoiseGit 克隆

Cloning via git command

通过 git 命令克隆

回答by hzwzw

Maybe you can fetch only the latest revision first and then fetch the rest:

也许你可以先只获取最新的修订版,然后再获取其余的:

$ git clone --depth=1 [email protected]:joe/hello-world.git
$ cd hello-world
$ git fetch --unshallow

Thanks this article!

感谢这篇文章

回答by Jeremy Paskali

There are two issues at play here:

这里有两个问题在起作用:

  1. Your OpenSSL is not up to date
  2. The SSH protocol is slower than HTTPS (but not by much)
  1. 您的 OpenSSL 不是最新的
  2. SSH 协议比 HTTPS 慢(但差不了多少)

Part 1. OpenSSL

第 1 部分。 OpenSSL

After following the directions from the article, http://darrell.mozingo.net/2011/09/29/painfully-slow-clone-speeds-with-msysgit-gitextensions/, I successfully boosted my network throughput for the git cloneoperation from 1 MiB/s to 28 MiB/s. This result was achieved by upgrading OpenSSL from version 0.9.8e to version 1.0.1e.

按照文章http://darrell.mozingo.net/2011/09/29/painfully-slow-clone-speeds-with-msysgit-gitextensions/ 中的说明进行操作后,我成功地将git clone操作的网络吞吐量从 1 提高了MiB/s 到 28 MiB/s。这个结果是通过将 OpenSSL 从 0.9.8e 版升级到 1.0.1e 版来实现的。

Part 2. SSH protocol

第 2 部分. SSH 协议

The SSH protocol a little bit slower than the HTTPS protocol, but not enough to warrant the speed differences I mentioned in Part 1 or what you are seeing. Please read through this article for more information on the Git protocols: http://media.pragprog.com/titles/tsgit/chap-008-extract.html.

SSH 协议比 HTTPS 协议慢一点,但不足以保证我在第 1 部分中提到的或您所看到的速度差异。请通读这篇文章以了解有关 Git 协议的更多信息:http: //media.pragprog.com/titles/tsgit/chap-008-extract.html

回答by scorpiondi

If you, like me, have configured TortoiseGit to use Putty's plink to connect (and use pageant, etc...), this might help you:

如果您像我一样将 TortoiseGit 配置为使用 Putty 的 plink 进行连接(并使用选美等...),这可能对您有所帮助:

Try enabling in Putty (Default Settings) the following settings:

尝试在 Putty(默认设置)中启用以下设置:

  1. SSH -> Auth: "Allow agent forwarding"(I believe this is the one that changes "everything")
  2. SSH -> "Enable Compression"
  3. Session -> Select "Default Settings" -> Save
  1. SSH -> Auth:“允许代理转发”(我相信这是改变“一切”的那个)
  2. SSH ->“启用压缩”
  3. 会话 -> 选择“默认设置” ->保存

For me, this resulted in going from 143.00 KiB/s to 4.50 MiB/s

对我来说,这导致从 143.00 KiB/s 到4.50 MiB/s

Hope this helps.

希望这可以帮助。