skip to Main Content

I’m aware that the slowness of git cloning is a popular topic on the web, but after browsing for a while I couldn’t find anything that appeared to match my specific problem.

I have a local Gitlab server which hosts, among other things, Terraform modules and Ansible roles. These get cloned respectively by Terraform itself and the Molecule testing tool. Often, but not always, when I use these tools from a CentOS 7 machine, both take several minutes to clone small repositories. Cloning the same repositories from the command line takes very little, as is to be expected. The one thing these have in common is that they are configured to use https URL’s with username and password embedded, as in:

https://user:password@host/repository.git

I’ve never experienced this problem when running the same Terraform command from Windows 10.

Is there anything I can try to speed this up? I’m aware I could try switching to ssh, but especially terraform is run embedded within a rather complex pipeline and making such a change would be somewhat complicate.

Update

I noticed that this problem gets worse over time. I just ran Molecule a few times after starting the VM from which I work. The first couple of times cloning was fast, now it’s slowing down. Could this have to do with entropy?

Update 2

I noticed that if I interrupt Molecule when it gets stuck and restart it immediately, the second time around the checkout is performed without delay.

2

Answers


  1. Chosen as BEST ANSWER

    I haven't experienced this problem since I upgraded the system's git package with a more recent one. It may be caused by a problem with the credential-cache, but I haven't actually verified if it is so.

    In case anyone is interested, I installed the git2u package from the IUS repository


  2. Clone only a branch and only the latest version:

    git clone -b master –single-branch –depth 1 $repo

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search