aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorTim D. Smith2016-03-12 18:36:12 -0800
committerXu Cheng2016-03-20 14:55:58 +0800
commit8aaa95ee993187f763b0953d3720b5f6308472d3 (patch)
tree36d3906171550d8f5aa5656ce2da7ebfb8a00eee /Library
parentf30221c7e1d626ddce3d923bc9da2ba880a7ceee (diff)
downloadbrew-8aaa95ee993187f763b0953d3720b5f6308472d3.tar.bz2
Add advice about keychain credentials
Fixes Homebrew/homebrew#50050. Closes Homebrew/homebrew#50059.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/utils.rb19
1 files changed, 14 insertions, 5 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 474c99612..1fbb5afac 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -487,7 +487,7 @@ module GitHub
GitHub #{error}
Try again in #{pretty_ratelimit_reset(reset)}, or create a personal access token:
#{Tty.em}https://github.com/settings/tokens/new?scopes=&description=Homebrew#{Tty.reset}
- and then set the token as: HOMEBREW_GITHUB_API_TOKEN
+ and then set the token as: export HOMEBREW_GITHUB_API_TOKEN="your_new_token"
EOS
end
@@ -498,11 +498,20 @@ module GitHub
class AuthenticationFailedError < Error
def initialize(error)
- super <<-EOS.undent
- GitHub #{error}
- HOMEBREW_GITHUB_API_TOKEN may be invalid or expired, check:
+ message = "GitHub #{error}\n"
+ if ENV["HOMEBREW_GITHUB_API_TOKEN"]
+ message << <<-EOS.undent
+ HOMEBREW_GITHUB_API_TOKEN may be invalid or expired; check:
#{Tty.em}https://github.com/settings/tokens#{Tty.reset}
- EOS
+ EOS
+ else
+ message << <<-EOS.undent
+ The GitHub credentials in the OS X keychain are invalid.
+ Clear them with:
+ printf "protocol=https\\nhost=github.com\\n" | git credential-osxkeychain erase
+ EOS
+ end
+ super message
end
end