JuliaLang/julia — pull request #6668 by kmsquire (2014-04-27 10:52:27+00:00)
Title: WIP: Enable github two-factor authentication; fixes #5252

I was getting annoyed at having to disable two-factor authentication to run `Pkg.publish()`. Here's an attempt at fixing that.

```julia
julia> Pkg.publish()
INFO: Validating METADATA
INFO: No new package versions to publish
INFO: Submitting METADATA changes
INFO: Forking JuliaLang/METADATA.jl to kmsquire
Enter host password for user 'kmsquire':
INFO: Two-factor authentication in use. Enter auth code. (You may need to re-enter your password.)
Authentication code: 420442
Enter host password for user 'kmsquire':

INFO: Pushing changes as branch pull-request/5068ad74
INFO: To create a pull-request open:

https://github.com/kmsquire/METADATA.jl/compare/pull-request/5068ad74
```

Remaining issues:
1. Because there are two calls to curl, we have to enter our password twice. (minor)
2. For the second password prompt, enter has to be pressed twice(!) (major)
3. Adding more than one auth token does not seem to be possible. For an existing token and a new machine, I get:
ERROR: 422: Validation Failed -- https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization
resource: OauthAccess
field: description
error code: already_exists

Regarding 2, which is the main annoyance, I'm stumped. I'm guessing some interaction between the repl and the spawned process is not letting curl see one of the return characters. Or maybe running the same process twice is causing issues.

Cc: @StefanKarpinski, @aviks