同じプロジェクト内に 2 つのリモートを追加する必要があります。
Git のプロジェクトを開始する
$ git init
Github リモートをプロジェクトに追加してプッシュするには:
$ git remote add origin https://github.com/user/repo.git
# Set a new remote
$ git remote -v
# Verify new remote
# origin https://github.com/user/repo.git (fetch)
# origin https://github.com/user/repo.git (push)
$ git add .
$ git commit -m "initial commit"
$ git push origin master
新しい Heroku プロジェクトを作成し、リモートをプロジェクトにプッシュするには:
$ heroku create
$ git remote -v
# Verify new remote (you will see heroku and origin now
# heroku git@heroku.com:falling-wind-1624.git (fetch)
# heroku git@heroku.com:falling-wind-1624.git (push)
# origin https://github.com/user/repo.git (fetch)
# origin https://github.com/user/repo.git (push)
$ git push heroku master
origin master
これは、常に git add してコミットし、 (Github) とheroku master
(Heroku)の両方にプッシュする標準的な戦略です。