そこらへんの大学生のブログ

iOS開発やったり、海外に住んだり、大学生やったりしてます。

Herokuを初めて使ってみた!!2

 

Gitのローカル・リモートリポジトリの作成!

$ git init
Initialized empty Git repository in /Users/ユーザ名/Desktop/適当なディレクトリ/.git/
$ git remote add heroku https://git.heroku.com/@@@.git
$ git remote -v
heroku	https://git.heroku.com/@@@.git (fetch)
heroku	https://git.heroku.com/@@@.git (push)


先ほどの$heroku create した時のURLをリモートリポジトリとして追加します!


リモートリポジトリにpushするための準備!


まずは公開するための適当なPHPファイル(index.php)を用意します!

<?php echo "Heroku Test!"; ?>


そのファイルをgit add, commitすれば準備完了です!

$ git add index.php
$ git commit -m "コメント"

 

リモートにpushして公開!

$ git push heroku master


これでpush完了です!
あとは$ heroku open -a アプリ名で公開されたwebページを表示できます!



f:id:Rwkabms:20181223042227p:plain


無事、上のようなページが表示されていれば成功です!