Fixes get repository name method.

Some remotes don't include the .git extension
so it changes the repo name regexp and adds an
optional regexp for the .git extension