LoginSignup
10
10

More than 5 years have passed since last update.

herokuアプリをコピーして別名アプリとして登録する(改訂版)

Last updated at Posted at 2014-05-06

既存のherokuアプリをコピーして, 別アプリとして動かしたい. そんなときの作業記録
ほぼ先人の知恵のまんまです.

前回の投稿では上手くいかないので改訂版です. すいません

  • heroku Toolbletが必要
  • 既存アプリをOLDAPP, 新規アプリをNEWAPPとする.

データベースや, add-onも全て引き継いでくれるそうです.

herokuでforkする

ココを参考に

$ heroku fork -a OLDAPP NEWAPP

forkしてもリポジトリはcloneしてくれないそうです.
なのでheroku git:clone -a NEWAPPしても中身なし.

OLDAPPをクローン

ローカルでコピーしても問題ないのですが, 今回はherokuからもらってきます.

$ heroku git:clone -a OLDAPP NEWAPP

クローンしただけなので, git remoteは

$ cd NEWAPP
$ git remote -v
# heroku    git@heroku.com:OLDAPP.git (fetch)
# heroku    git@heroku.com:OLDAPP.git (push)
# ...

になってるはず.

remoteリポジトリを再指定する

newAPPのgit URLが

$ heroku info -a NEWAPP

# === NEWAPP
# ...
# Git URL:       git@heroku.com:NEWAPP.git
# ...

になってるので, ここのGit URLをherokuとする

$ cd NEWAPP
$ git remote rm heroku
$ git remote add heroku git@heroku.com:NEWAPP.git

確認

$ cd NEWAPP
$ heroku info
# === NEWAPP
# ...

push

あとはいつもどおりに

$ git push heroku master

でOK

参考

Trying to heroku git:clone after heroku fork yields an empty repository

Forking Applications

10
10
1

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