Fix removal of `.git` suffix.
The intention is to remove the `.git` that may be added to, e.g., GitHub
repository URLs. If there's a `/v2` or similar after, then we want to
match a slash with the suffix. If the suffix is at the end, then the
earlier code would have appended a slash _anyway_, and so we still want
to match a slash.
Allowing `.git` without slash incorrectly catches things like the middle
of `code.gitea.com`.