LoginSignup
1
1

More than 3 years have passed since last update.

GitHub PagesでHello Worldしよう

Posted at

はじめに

GitHubのページを見ながら、GitHub PagesによるHello Worldページを作成したい。

手順

新しいレポジトリ作成

GitHubで「Create a new repository」ページでRepository nameを{ユーザ名}.github.ioを入力する。
スクリーンショット 2020-08-07 14.27.40.png

レポジトリをクローン

今回はMacのTerminalで行うこととする。
ページでは該当のフォルダーでgit clone https://github.com/{ユーザ名}/{ユーザ名}.github.ioでクローンするということだが、remote: Repository not found.エラーが出た。

SouceTreeでCloneしたらremote: Repository not found.となった時の対応方法によると、上記エラーの原因がユーザー名とパスワードを入力しないと認証できないためらしい。
上記エラーが出たら、下記コマンドでクローンする。

$ git clone https://{ユーザ名}:{パスワード}@github.com/{ユーザ名}/{ユーザ名}.github.io.git

Hello World

該当ディレクトリで、index.htmlを作成。

$ cd {ユーザ名}.github.io
$ echo "Hello World" > index.html

プッシュする

Gitの一連のコマンドを入力。

$ git add --all
$ git commit -m "Initial commit"
$ git push -u origin master

ブラウザで確認

https://{ユーザ名}.github.io
上記URLで「Hello World」できているか確認する。
スクリーンショット 2020-08-07 14.51.16.png

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