0. はじめに
大阪のLaravel初学者サウナーこと、kazumakishimoto(@kazuma_dev)です!
CircleCIでHeroku自動デプロイ時に認証エラーが発生しました。
0-1. 全体の流れ
0-2. 本記事の対象者
-
git push --all
(自動デプロイ)、git push heroku master
(手動デプロイ)などで認証エラー
0-3. 事前準備
- HerokuでCircleCI自動デプロイ設定済み
1. 試したこと
-
git push --all
(自動デプロイ)
local
$ git push --all
2. エラーメッセージ
#!/bin/bash -eo pipefail
git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git master
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://git.heroku.com/****.git/'
Exited with code exit status 128
CircleCI received exit code 128
3. 解決方法
- Heroku API KEYが更新されているので、CircleCIに再設定
3-1. Herokuログイン
local
$ heroku login
3-2. API
3-3. 再デプロイ
local
$ git push --all
補足
開発環境(FW/ツールのバージョンなど)
ツール | バージョン |
---|---|
Vue.js | 2.6.14 |
jQuery | 3.4.1 |
PHP | 7.4.1 |
Laravel | 6.20.43 |
MySQL | 5.7.36 |
Nginx | 1.18.0 |
Composer | 2.0.14 |
npm | 6.14.6 |
Git | 2.33.1 |
Docker | 20.10.11 |
docker-compose | v2.2.1 |
PHPUnit | 8.0 |
CircleCI | 2.1 |
heroku | 7.59.4 |
MacBook Air | M1,2020 |
macOS | Monterey 12.3 |
Homebrew | 3.3.8 |
ディレクトリ構造
【ルートディレクトリ】
├─ .circleci
│ └─ config.yml
├─ aws / CloudFormation
│ └─ ec2.yml
├─ docker
│ └─ mysql
│ └─ nginx
│ └─ php
│ └─ phpmyadmin
├─ src
│ └─ 【Laravelのパッケージ】
└─ docker-compose.yml
Reference