Skip to content

Conversation

@tomjonandy
Copy link
Contributor

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example. N/A
  • Have you successfully run brew tests with your changes locally?

This fixes #3363

I would also suggest that lines 32-52 of Library/Homebrew/utils/github.rb be rewritten to use :environment and :keychain rather than re-reading the environment variable (as this would have avoided some of the confusion that this bug caused), although I could be missing something that would mean this wouldn't work. (I would be happy to either add that change to this this pull request or create a new one for the purpose as you see fit).

@MikeMcQuaid
Copy link
Member

If I'm understanding this correctly: this will always prefer the environment variable over the keychain if both are set, right? That seems reasonable to me but I'm just checking it is what I think it is.

@tomjonandy
Copy link
Contributor Author

That was always the case anyway (see the if block in function api_credentials, lines 54 - 71 of Library/Homebrew/utils/github.rb), this fixes a bug where if there was just one thing returned from api_credentials (meaning it is a personal access token, see line 57 of the same file) api_credentials_type was set as :keychain. If it returned 2 things (meaning it is a username and password) it was set as :environent, when those tokens should have been the other way around. This meant that if someone isn't using a personal access token, but has git credentials in keychain, it was treating the password from those credentials as a personal access token, which obviously doesn't work.

@MikeMcQuaid MikeMcQuaid merged commit c59c0d6 into Homebrew:master Oct 29, 2017
@MikeMcQuaid
Copy link
Member

Thanks for your great first contribution to Homebrew, @tomjonandy! Without people like you submitting PRs we couldn't run this project. You rock!

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error says keychain GitHub credentials may be invalid when they they are correct

2 participants