Similar to what is done in _initial_checkout function with try/except. There is now some common code that could be refactored into one get_list_of_remote_branches function.
If you git server displays an ssh banner after login, this code currently chokes.