Fix repo name for URLs without .git extension

Only strip out '.git' from the repo name if it exists.