git_connect(): refactor the port handling for ssh