cache: Handle cases where git url contains host more than once

Slight fixup for #3224