Light refactoring, bug fix and regression test

The `github` command failed when there was a ".git" in the repo name, as happens for github pages.