LoginSignup
11
11

More than 5 years have passed since last update.

Heroku へ HTTPS でデプロイする

Last updated at Posted at 2015-01-30

昨年末に HerokuHTTPS 経由での Git に対応 しました :clap:
これで SSH が通らない環境でもデプロイできますね :exclamation:

最新の Heroku Toolbelt がインストールしている前提で話を進めていきます。

新しいアプリケーションを作る場合

1. Heroku に新しいアプリケーションを作る。この際に --http-git を指定する。

$ heroku apps:create --http-git
Creating アプリケーション名... done, stack is cedar-14

2. 新しい git レポジトリを作る

$ git init

3. Heroku を git のリモートとして登録する。

$ heroku git:remote -a アプリケーション名
Git remote heroku added

4. 確認する。

$ git remote show heroku
* remote heroku
  Fetch URL: https://git.heroku.com/アプリケーション名.git
  Push  URL: https://git.heroku.com/アプリケーション名.git

Fetch URL と Push URL が https で始まっていれば OK です :exclamation:

既存のアプリケーションを SSH から HTTPS に変更する場合

1. まずはこんな感じで SSH 経由になっているはず(git@heroku.com

$ git remote show heroku
Fetching repository, done.
* remote heroku
  Fetch URL: git@heroku.com:アプリケーション名.git
  Push  URL: git@heroku.com:アプリケーション名.git
  HEAD branch: master
  Remote branch:
    master tracked
  Local ref configured for 'git push':
    master pushes to master (local out of date)

2. heroku git:remote --http-git で変更しましょう。

$ heroku git:remote --http-git
Git remote heroku updated

3. もう一度1のコマンドで確認すると…

$ git remote show heroku
* remote heroku
  Fetch URL: https://git.heroku.com/アプリケーション名.git
  Push  URL: https://git.heroku.com/アプリケーション名.git
  HEAD branch: master
  Remote branch:
    master tracked
  Local ref configured for 'git push':
    master pushes to master (local out of date)

ちゃんと HTTPS になってますね:exclamation:

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