Referring <http://git-scm.com/docs/git-fetch#_git_urls>, `ssh://git@example.com:22/path/to/repo` is also valid remote URL. And the regexp seems to match incorrectly with it. I think you should do this conversion only if `ref` does not have scheme part.