# How to clone faster via ssh ?

6 messages from 2005-10-25 to 2005-10-26. Participants: Alexander Litvinov, Johannes Schindelin, Junio C Hamano.
Thread: https://gitlist.dev/t/2215

## Alexander Litvinov, 2005-10-25 07:49

Subject: How to clone faster via ssh ?
Message-ID: <200510251449.15302.lan@ac-sw.com>
URL: https://gitlist.dev/e/200510251449.15302.lan%40ac-sw.com

```
Hello,

I have cvs project imported into git. When unpacked it contains about 205000 
objects. I have made one pack and daily rerun cvsimport to get new changes.

When I do cloning via http it takes less than 3 minutes:
time git-clone -n http://127.0.0.1:8080/git/r/.git r2
real    2m31.062s
user    1m33.562s
sys     0m5.462s

When I do cloning via ssh it takes more than 10 minutes and horde of unpacked 
objects:
Packing 204607 objects
Unpacking 204607 objects
 100% (204607/204607) done

real    13m41.510s
user    1m52.655s
sys     1m5.057s

There are no packs in cloned repo:
ls -la r3/.git/objects/pack/
total 6
drwxr-xr-x    2 lan users   48 Oct 25 13:51 .
drwxr-xr-x  260 lan users 6240 Oct 25 14:05 ..
lan@lan:~/tmp/git/billing

We can't share our project via http - we need authorization for it. Is is 
possible to clone this repo via ssh as http clone does ? Its will be much 
faster and will simplify work with such directory - it is hard to delete it 
after cloning - takes from 5 up to 10 minutes ! Filesystem is reiserfs.

Thanks for help,
Alexander Litvinov.

```

## Alexander Litvinov, 2005-10-25 07:54

Subject: Re: How to clone faster via ssh ?
Message-ID: <200510251454.35202.lan@ac-sw.com>
URL: https://gitlist.dev/e/200510251454.35202.lan%40ac-sw.com
In-Reply-To: <200510251449.15302.lan@ac-sw.com>

```
Forgot to tell:
clone via ssh was made using this command:
time git-clone -n ssh://lan@lan/home/lan/tmp/git/billing/repo r3
> When I do cloning via ssh it takes more than 10 minutes and horde of
> unpacked objects:
> Packing 204607 objects
> Unpacking 204607 objects
>  100% (204607/204607) done
>
> real    13m41.510s
> user    1m52.655s
> sys     1m5.057s

```

## Johannes Schindelin, 2005-10-25 09:04

Subject: Re: How to clone faster via ssh ?
Message-ID: <Pine.LNX.4.63.0510251103110.24174@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0510251103110.24174%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <200510251454.35202.lan@ac-sw.com>

```
Hi,

On Tue, 25 Oct 2005, Alexander Litvinov wrote:

> Forgot to tell:
> clone via ssh was made using this command:
> time git-clone -n ssh://lan@lan/home/lan/tmp/git/billing/repo r3

If you have a working git on the other side, you could do

	time git-clone lan@lan:/home/lan/tmp/git/billing/repo r3

which would utilize git-clone-pack. Way faster.

Ciao,
Dscho

```

## Alexander Litvinov, 2005-10-25 11:30

Subject: Re: How to clone faster via ssh ?
Message-ID: <200510251830.24550.lan@ac-sw.com>
URL: https://gitlist.dev/e/200510251830.24550.lan%40ac-sw.com
In-Reply-To: <Pine.LNX.4.63.0510251103110.24174@wbgn013.biozentrum.uni-wuerzburg.de>

```
> If you have a working git on the other side, you could do
>
> 	time git-clone lan@lan:/home/lan/tmp/git/billing/repo r3
>
> which would utilize git-clone-pack. Way faster.

I have tried this command:
lan@lan> time git-clone lan@lan:/home/lan/tmp/git/billing/repo r3
defaulting to local storage area
lan@lan's password:
Packing 204607 objects
Unpacking 204607 objects
Killed by signal 2.) done

real    4m0.874s
user    0m0.013s
sys     0m0.120s

I have killed it at ~ 20%. As I understand it does exactly what ssh git thru 
ssh transport does: git-rev-list |  git-pack | ssh | git-unpack or something 
like this. So it is not faster.

```

## Junio C Hamano, 2005-10-25 17:17

Subject: Re: How to clone faster via ssh ?
Message-ID: <7vbr1dh5y7.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vbr1dh5y7.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.63.0510251103110.24174@wbgn013.biozentrum.uni-wuerzburg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> On Tue, 25 Oct 2005, Alexander Litvinov wrote:
>
>> Forgot to tell:
>> clone via ssh was made using this command:
>> time git-clone -n ssh://lan@lan/home/lan/tmp/git/billing/repo r3
>
> If you have a working git on the other side, you could do
>
> 	time git-clone lan@lan:/home/lan/tmp/git/billing/repo r3
>
> which would utilize git-clone-pack. Way faster.

I think both of these notations do the same.

The time to unpack the resulting pack on this end is eliminated
if you use git from last week, namely this commit:

commit e1c7ada6dd1fdf249d0bb84f3293d3be768b9239
Author: Junio C Hamano <junkio@cox.net>
Date:   Wed Oct 19 14:43:43 2005 -0700

    git-clone: always keep pack sent from remote.

    This deprecates --keep and -q flags and always keeps the
    pack
    sent from the remote site.  Corresponding configuration
    variables are also removed.

    Signed-off-by: Junio C Hamano <junkio@cox.net>

But you would still pay for creating a pack on the remote side.

```

## Alexander Litvinov, 2005-10-26 02:46

Subject: Re: How to clone faster via ssh ?
Message-ID: <200510260946.58443.lan@ac-sw.com>
URL: https://gitlist.dev/e/200510260946.58443.lan%40ac-sw.com
In-Reply-To: <7vbr1dh5y7.fsf@assigned-by-dhcp.cox.net>

```
> The time to unpack the resulting pack on this end is eliminated
> if you use git from last week, namely this commit:
>
> commit e1c7ada6dd1fdf249d0bb84f3293d3be768b9239
> Author: Junio C Hamano <junkio@cox.net>
> Date:   Wed Oct 19 14:43:43 2005 -0700
>
>     git-clone: always keep pack sent from remote.
>
>     This deprecates --keep and -q flags and always keeps the
>     pack
>     sent from the remote site.  Corresponding configuration
>     variables are also removed.
>
>     Signed-off-by: Junio C Hamano <junkio@cox.net>
>
> But you would still pay for creating a pack on the remote side.

Yeah ! Thanks.

Version for todays master branch works much faster:
lan@lan:~/tmp/git/billing> time git-clone -n 
ssh://lan@lan/home/lan/tmp/git/billing/repo r1
defaulting to local storage area
lan@lan's password:
Packing 204607 objects

real    4m0.107s
user    0m11.879s
sys     0m1.717s

And it makes only one pack. Great.

```
