There are not a whole lot of details here, but it seems that you are cloning a repo that is somewhat large which git handles very poorly unless you have large amounts of RAM around. Have you looked into tuning you git parameters to optimize the cloning?
Something I would look into:
look for large files, even if they are deleted in the main branch. They will make your clones consume a lot of RAM.
add all sorts of binaries (exe, zip, tgz, dll, so, etc…) to .gitignore to help prevent large files uploads.
add a git rule to prevent files over 1MB to be uploaded.
run big to delete all binaries and large files from the repository history.
Git is very very very poor at managing binaries, it was designed for source code and source code only, and git-lfs is its own can of worms. So avoid large binaries in git as much as you can.