connect: refactor git_connect to only get the protocol version once