Feels to me like you could improve a lot of the noisiness by adding || (or) to the end of each line. So the script would stop trying things once it found something that worked. Then maybe you could reintroduce the git clone command -- coming near the end, it would rarely cause problems.