LoginSignup
18
11

More than 5 years have passed since last update.

hubコマンドでUnauthorized(HTTP 401)エラー

Last updated at Posted at 2018-05-13

環境

OSX High Sierra
git version 2.14.3 (Apple Git-98)
hub version 2.2.9

問題

hubコマンドで認証に失敗する。

$ hub clone dyoshikawa/my-private-repo
Error getting repository: Unauthorized (HTTP 401)
Bad credentials

解決法

https://github.com/github/hub/issues/1067

GitHubのダッシュボードからSetting→Developer settings→Personal access tokensを開く。
tokenをRegenerateして新しく生成されたトークンをコピー。

Macで~/.config/hubをエディタで開き、oauth_tokenを置換する。

~/.config/hub
github.com:
- user: dyoshikawa
  oauth_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  protocol: https
18
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
11