Use the GitHub API to determine repository validity.

Review Request #4853 — Created Oct. 26, 2013 and submitted — Latest diff uploaded

Review Board

Use the GitHub API to determine repository validity.

We were previously attempting to access GitHub repositories directly
through Git, which required a valid SSH key configured. This led to
some problems.

  1. It required that the user properly create and associate an SSH key.
    While annoying, this was actually made worse by the "Associate SSH
    key" checkbox, which associated as a deploy key. Deploy keys could
    only be used for one repository at a time, and this caused massive
  2. It meant that we only knew that a repository could be accessed by
    that key, but we didn't know if anything else was invalid.
  3. It was a problem in networks that didn't allow SSH access to the
    outside world.
  4. When validation failed, we didn't know much, and the resulting error
    was hard to figure out.

Now, the GitHub API is used to validate repositories. We can tell the
user that the repository wasn't found, and list possible reasons why. We
can also make sure that there isn't a mismatch between the selected plan
and the public/private setting of the repository.

Hand-tested every error condition, as well as a valid repository.

Saw that the Associate SSH Key checkbox was gone.

Unit tests pass.