If your checkout step is intermittently failing with the below error message (or similar), it can often be caused by networking issues :
These issues often occur when the size of your repository is large. You can resolve this issue by either using a custom checkout step in a run command with retries or a custom checkout step to implement a partial or shallow clone.
You can find more details on how to retry an intermittently failing step here. Your custom command will look like the following:
- run: for i in $(seq 1 5); do checkout && s=0 && break || s=$? && sleep 5; done; (exit $s)