1
0

More than 1 year has passed since last update.

HerokuでWeb名(app名)変更時の再push方法

Last updated at Posted at 2022-07-19

Node.jsの初心者です。

herokuでapp名を変更するとgitリポジトリが変更になります。
この時、ローカルリポジトリは更新されていないため
変更したリモートリポジトリにpushできなくなりはまりました。
検索しても載っていなかったためこの時の解決手順を書こうと思います。

  1. ローカル環境の.gitフォルダを削除する
  2. git bashを起動しローカルのappフォルダに移動
  3. git init g初期化
  4. git add . ステージングエリアに追加
  5. git commit -m "リポジトリ変更対応" コミットする
  6. heroku git:remote -a 新アプリ名 新リモートリポジトリを設定
  7. git push -f heroku master リモートリポジトリを強制的に上書き

要は最初からgitを作り直して
変更先にリモートリポジトリに強制的に上書きをするという方法です。

commitを戻したりしていてハマってしまった場合の一から作り直す手順になります。

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