「git push heroku master」コマンドでWARNINGエラーが出た場合の対処法

cropped-code-820275_1280-1.jpg Python

さて今回は、Herokuにプログラムをアップロードしようとしたときに発生した「Do not authenticate with username and password using git.」のエラーが出た時の対処法を備忘録として書いておきます。

エラー内容

Herokuに以下のコマンドを実行する

  • sudo git push heroku master

そうすると以下のようなエラーが発生。

Username for 'https://git.heroku.com': ***
Password for 'https://***@git.heroku.com':
remote: ! WARNING:
remote: ! Do not authenticate with username and password using git.
remote: ! Run `heroku login` to update your credentials, then retry the git command.
remote: ! See documentation for details:

Deploying with Git | Heroku Dev Center
Git is a powerful decentralized revision control system, and is the means for deploying apps to Heroku.
fatal: Authentication failed for 'https://git.heroku.com/kuzibiki.git/'

エラーを見ると「Run `heroku login` to update your credentials, then retry the git command.」と書いてあったのでもう一度「heroku login」してみたが状況は変わらずでした。

対処法

ググっていると以下のサイトに対処方法が書いてありました。

Herokuにアプリをpushしたときにエラーが出る場合の対処法

以下サイトによると「heroku auth:token」コマンドで出てくる「APIトークン」を入力することで解決できると書いてましたので試してみます。

  • heroku auth:token

コマンドを入力すると次のように表示され、最後にAPIトークンが表示されます

(node:8812) SyntaxError Plugin: heroku: /home/test/.local/share/heroku/config.json: Unexpected end of JSON input
module: @oclif/config@1.17.0
task: runHook prerun
plugin: heroku
root: /snap/heroku/4076
See more details with DEBUG=*
› Warning: token will expire 11/14/2021
› Use heroku authorizations:create to generate a long-term token
bc2776d2-ffee-459c-ad36-*****

もう一度「sudo git push heroku master」を実行して、PWに先ほどのAPIトークンを入れます。

PW:bc2776d2-ffee-459c-ad36-*****

そうすると正常にHerokuにプログラムを送ることができました!!

ブログのパーくんさん本当にありがとうございました!!

短いですが今回は以上となります。ありがとうございました。

 

コメント

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