Search code examples
gitsshclone

Git clone slow?


I just recently noticed that when I clone a new repo (regardless of size), git clone seems to hang. I've tried running in verbose mode but I don't see anything.

If I wait long enough, it eventually clones but it is way slower than it's been before.

All other git commands work just fine. I can push, pull, fetch, etc no problem. I only notice slowness when I clone.

My download speeds are just fine (80 mbps down) and I know it isn't repo specific because I can make a new, tiny repo on github and try to clone it and it takes 10+ minutes.

The only thing I can think of is if it's something with SSH. I did recently add a new SSH key. I haven't had trouble authenticating (as far as I can tell). I usually use ssh to clone, I just tried over HTTPS and I had the same slowness.

Here's a what I saw on my last successful clone:

Cloning into 'repo-name'...
error: ignoring template /Users/username/Library/Group Containers/gdrive/tmp0F0X6n
error: ignoring template /Users/username/Library/Group Containers/gdrive/tmplj3WUJ
error: ignoring template /Users/username/Library/Group Containers/gdrive/tmpPGME7Z
error: ignoring template /Users/username/Library/Group Containers/gdrive/tmpSbnzav
error: ignoring template /Users/username/Library/Group Containers/gdrive/tmpTer2Uf
remote: Counting objects: 172, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 172 (delta 17), reused 14 (delta 14), pack-reused 153
Receiving objects: 100% (172/172), 18.86 KiB | 0 bytes/s, done.
Resolving deltas: 100% (88/88), done.
Checking connectivity... done.

Solution

  • Don't clone a repository and place it on Google Drive. Git uses many file accesses and each request on a network stored location (such as Google Drive) will increase significant delays due to network latency and performance of the network server.

    You should also check that git isn't installed/running from GDrive, as this will pull in the templates (from /usr/share/git-core/templates) and these are read significantly when creating a clone for the first time. You may find it's picking up something from the GIT_TEMPLATE_DIR environment variable.