-->

Git Clone is too slow

2019-03-10 06:10发布

问题:

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!

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

Can anybody give me some suggestions?

回答1:

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

$ git clone --depth=1 git@github.com:joe/hello-world.git
$ cd hello-world
$ git fetch --unshallow

Thanks this article!



回答2:

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)

Part 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 clone operation 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.

Part 2. SSH protocol

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.



回答3:

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

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

  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

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

Hope this helps.