Exception: GitHub::AuthenticationFailedError

Inherits:
Error
  • Object
show all
Defined in:
brew/Library/Homebrew/utils/github.rb

Instance Attribute Summary

Attributes inherited from Error

#github_message

Instance Method Summary collapse

Constructor Details

#initialize(github_message) ⇒ AuthenticationFailedError

Returns a new instance of AuthenticationFailedError



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'brew/Library/Homebrew/utils/github.rb', line 48

def initialize(github_message)
  @github_message = github_message
  message = +"GitHub #{github_message}:"
  if ENV["HOMEBREW_GITHUB_API_TOKEN"]
    message << <<~EOS
      HOMEBREW_GITHUB_API_TOKEN may be invalid or expired; check:
        #{Formatter.url("https://github.com/settings/tokens")}
    EOS
  else
    message << <<~EOS
      The GitHub credentials in the macOS keychain may be invalid.
      Clear them with:
        printf "protocol=https\\nhost=github.com\\n" | git credential-osxkeychain erase
      Or create a personal access token:
        #{ALL_SCOPES_URL}
      #{Utils::Shell.set_variable_in_profile("HOMEBREW_GITHUB_API_TOKEN", "your_token_here")}
    EOS
  end
  super message.freeze
end