Validate repo/branch path, strip off .git extension

If you paste in a git clone URL like this:

https://github.com/remy/5minutefork.git

It's accepted, but sends you down an infinite loop, cloning a repo that doesn't exist.

I changed the validation regexp to trim off the .git suffix if it exists using non-greedy matching. It also validates the pathname syntax (foo/bar or foo/bar/tree/baz).