Visual Studio Code で Bitbucket を使う(2022年3月1日以降)

WEB+DB開発
記事内に広告が含まれています。

久しぶりに Bitbucket のリポジトリをクローンしようとしたら以下のエラー。

fatal: Invalid credentials
remote: Bitbucket Cloud recently stopped supporting account passwords for Git authentication.
remote: See our community post for more details: https://atlassian.community/t5/x/x/ba-p/1948231
remote: App passwords are recommended for most use cases and can be created in your Personal settings:
remote: https://bitbucket.org/account/settings/app-passwords/
fatal: Authentication failed for 'https://bitbucket.org/foo/bar.git/'

https://atlassian.community/t5/x/x/ba-p/1948231 を確認してみたら、

Bitbucket Cloud users will no longer be able to use their account passwords when using Basic authentication for Git over HTTPS and the Bitbucket Cloud REST API.

ということらしいです。

まず https://bitbucket.org/account/settings/app-passwords/ にアクセスして、個別アプリ用のパスワード(App password)を適当な名前(例:VS Code)で生成します。一度きりしか表示されないので注意。

次に、アカウント名(メールアドレス)と生成したパスワードを資格情報マネージャー (Windows Credential Manager)に登録します。Windows 10 の場合は、【コントロールパネル】→【ユーザー アカウント】→【資格情報マネージャー】→【Windows 資格情報】の【汎用資格情報の追加】をクリックして以下を入力して保存。

  • インターネットまたはネットワークのアドレス: https://bitbucket.org
  • ユーザー名: Bitbucket アカウントのメールアドレス
  • パスワード: 先ほど生成した個別アプリ用のパスワード

その後、VS Code から Bitbucket のリポジトリをクローンすると、認証用のダイアログ → ウェブブラウザで認証確認画面が表示されるので許可すればOK。

タイトルとURLをコピーしました