Git clone failures on Mac

I’m getting clone failure like this a lot when using my Mac(see below). I saw a tip which recommended I add -depth=1 which does work. However the problem I have below is the clone is called from an installation script for qmk setup so I can’t add the depth hack … is anyone else getting this issue … anyone aware of a workaround ? is there a way to set depth = 1 as standard?

Cloning into ‘/Users/franklynch/qmk_firmware’…

error: RPC failed; curl 18 transfer closed with outstanding read data remaining

fatal: the remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

☒ git clone exited 128

How are you cloning it? Like this:

git clone https://github.com/[username]/[repo]

or like this:

git clone git@github.com:[username]/[repo].git

Maybe try cloning with ssh?

ssh://git@github.com:[username]/[repo].git