LoginSignup
0
0

More than 3 years have passed since last update.

CircleCIからHerokuへのログインが必要なかった

Posted at

概要

  • GitHubへpushするとCircleCIが動作しHerokuへデプロイする仕組みを製作中にハマった。

事象

  • CircleCIからHerokuへログインするのが失敗したとエラーメッセージが出た。
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: https://devcenter.heroku.com/articles/git#http-git-authentication
fatal: Authentication failed for 'https://heroku:@git.heroku.com/.git/'

CircleCI_to_Heroku_push_miss.PNG

対処法

そこでHerokuへのログイン認証が失敗していると思い.circleci/config.ymlに下記記述を追加。

.circleci/config.yml
jobs:
  deploy:
    executor: heroku/default
    steps:
      - checkout
      - heroku/install
      - run: heroku login # Herokuにログインする処理を追加
      - heroku/deploy-via-git:
          only-branch: main

すると下記エラーが発生

Error: Cannot log in with HEROKU_API_KEY set

CircleCI_to_Heroku_login_miss.PNG

こちらの記事を参考にAPIキーを再発行して挑戦。
しかし失敗。。。

解決策

結論としては- run: heroku loginを削除したら問題なく動いた。
エラーメッセージのRun heroku loginとは何だったのか。。。

所感

言われてみれば確かにCircleCIからHerokuへ認証ってどうやっているんだろうと不思議に思い
認証を頑張っていたがなぜか一向に成功せず。
ダメもとで一旦ログイン処理を削除したらなぜか後続の処理が動作した、
ここら辺の仕組みがどうなっているかさっぱり謎だがとりあえず動いたのでまあよし(現場猫)

0
0
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
0
0