CircleCi restore source cache questions & pb

Hi all,

In CHECKOUT phase there are 2 steps: ‘restoring source cache’ and 'checkout’
Could someone explain why CircleCI is restoring my .git folder before checking out the repo ?

and why I ended with git errors after checking out my repo ?

See "git help gc" for manual housekeeping.
error: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.

error: Could not read f4e6d03ae3a8c70442298476231d34e935356d92
fatal: Failed to traverse parents of commit 76d87db51d6dc6406afaf7cb974f9a1b2873d976
error: failed to run repack

That would be of great help.
Thank you.
Yann

Ok, to solve my problem an to be sure the local repo stay in a good shape I did the following:

  • connect in ssh to the VM to delete the git folder: leads to a build failure

  • then ask for a rebuild which to have a fresh repo

  • added some git gc in the circle.yml ‘post:’ checkout section

    checkout:
    post:
    - git remote prune origin
    - git reflog expire --expire-unreachable=now --all
    - git gc --prune=now

The above steps only take less than 10s to execute.
So far, no more error.

Interesting! I’m trying to make our “restoring source cache” step faster. I might try some git repo hacking to make it smaller, similar to what you did here to fix errors with the cache. I’ve posted a separate question about the source cache performance: