Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'git clone' asks for auth and then fails #558

Closed
jordansissel opened this issue Apr 23, 2014 · 6 comments
Closed

'git clone' asks for auth and then fails #558

jordansissel opened this issue Apr 23, 2014 · 6 comments

Comments

@jordansissel
Copy link

I have two confusions. First, that 'git clone' (hub clone) is asking me for credentials for a public repo. Ignoring that, even after providing credentials, it fails. I've doublechecked the two-factor code sent to my phone and it was correct.

hub version 1.11.2

% git clone elasticsearch/elasticsearch
github.com username: jordansissel
github.com password for jordansissel (never stored):
two-factor authentication code: 462411
/Users/jls/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http/response.rb:119:in `error!': 422 "Unprocessable Entity" (Net::HTTPServerException)
        from /Users/jls/.rvm/gems/ruby-2.0.0-p353/gems/hub-1.11.2/lib/hub/github_api.rb:333:in `obtain_oauth_token'
        from /Users/jls/.rvm/gems/ruby-2.0.0-p353/gems/hub-1.11.2/lib/hub/github_api.rb:319:in `obtain_oauth$token'
@mislav
Copy link
Owner

mislav commented Apr 23, 2014

You should first upgrade to the latest version (1.12.0).

Now, the credentials aren't for cloning the repo itself (the repo is public, after all). Hub asks you for your credentials in general so it can cache the OAuth token for all future communication with the GitHub API on your behalf. This is a one-time operation.

The 422 is weird and may indicate a bug with the GitHub API. Please upgrade hub to the newest version, try again, and paste me the error message if it happpens to contain more information than before.

If the error is identical, you can use HUB_VERBOSE=1 git clone ... to obtain a dump of HTTP traffic that you can paste me (with parts anonymized, if needed).

@jordansissel
Copy link
Author

Confirmed upgrading fixed it. Thanks for the quick response. :)

@mislav mislav closed this as completed Apr 24, 2014
@alxndr
Copy link

alxndr commented May 14, 2014

I'm getting a similar-looking problem, but with hub v1.12.0 already installed.

$ git --version                                                                               [19:28:53]
git version 1.8.5.2 (Apple Git-48)
hub version 1.12.0

When I HUB_VERBOSE=1 git clone 2-n, here's the important-looking part before the failure:

> POST https://api.github.com/authorizations
> Authorization: Basic [REDACTED]
> X-GitHub-OTP: 142026
{"scopes": ["repo"], "note": "hub", "note_url": "http://hub.github.com/"}
< HTTP 422
{"message":"Validation Failed","documentation_url":"https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization","errors":[{"resource":"OauthAccess","code":"already_exists","field":"description"}]}
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:119:in `error!': 422 "Unprocessable Entity" (Net::HTTPServerException)
    from /usr/local/bin/hub:547:in `obtain_oauth_token'

@mislav
Copy link
Owner

mislav commented May 14, 2014

@alxndr This sounds like #531 and #563. Please follow the latter for updates

mislav added a commit that referenced this issue May 15, 2014
When looking up an existing hub token among user's authorizations, be
sure to fetch all results by following pagination links. Previously we
just stopped at the 1st page, and if the token for hub didn't appear
there we would try to create it, which would result in a 422 validation
error if it already existed.

References 1e4477b

Fixes #531, fixes #558, fixes #563
@alxndr
Copy link

alxndr commented May 30, 2014

I fixed the issue by deleting a token named "hub" from the Personal access tokens area of https://github.com/settings/applications. I don't remember how it got there, but hub ci-status ended up complaining like this:

Error fetching CI status: Unprocessable Entity (HTTP 422)
Duplicate value for "description"

@mislav
Copy link
Owner

mislav commented May 30, 2014

@alxndr This got fixed in v1.12.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants