diff --git a/Library/Homebrew/utils/github/api.rb b/Library/Homebrew/utils/github/api.rb index 4dc96c50d5..324986fce2 100644 --- a/Library/Homebrew/utils/github/api.rb +++ b/Library/Homebrew/utils/github/api.rb @@ -177,8 +177,9 @@ module GitHub print_stderr: false return unless result.success? - github_username = git_credential_out[/username=(.+)/, 1] - github_password = git_credential_out[/password=(.+)/, 1] + git_credential_out.force_encoding("ASCII-8BIT") + github_username = git_credential_out[/^username=(.+)/, 1] + github_password = git_credential_out[/^password=(.+)/, 1] return unless github_username # Don't use passwords from the keychain unless they look like