gitでページを公開する
gitでページを公開できたので説明していきたい。
code:git
/* まず、レポジトリーにクローンする,uriの中に入るのは、http,httpsから始まるurlやsshプロトコルで指定するもの、gitoliteなどの他のソフトウェアと連携するもの*/
fatal: destination path 'rikotsuka.github.io' already exists and is not an empty directory.
/*エラーメッセージにかかれている通り、「宛先のパスは既に存在しており、しかも、それは空のディレクトリ(=フォルダ)ではない」から失敗しているだけです。*/
bread-is-pan:~ riko$ cd rikotsuka.github.io
bread-is-pan:rikotsuka.github.io riko$ echo "Hello World" > index.html
/*rikotsukaレポジトリに移動してindex.htmlを読み込む*/
bread-is-pan:rikotsuka.github.io riko$ git add --all
/*git add .と同じ意味合いらしい、ファイルをステージングに追加*/
bread-is-pan:rikotsuka.github.io riko$ git commit -m "Initial commit"
/*ファイルやディレクトリの追加・変更を、リポジトリに記録するにはコミット,最初のコミット*/
1 file changed, 1 insertion(+), 16 deletions(-)
rewrite index.html (100%)
bread-is-pan:rikotsuka.github.io riko$ git push -u origin master
/*変更情報を記録できたのでpushする*/
Branch master set up to track remote branch master from origin.
Everything up-to-date
↑前に書いた記事が参考になる、ローカルのmasterブランチの内容がリモートに送信された、という意味
/*リモートにローカルを加える*/
fatal: remote origin already exists.
/*もう存在しているよ!*/
bread-is-pan:rikotsuka.github.io riko$ git commit -m "Initial commit"
On branch gh-pages
nothing to commit, working directory clean
/*git addしてない状態なのでコミットしても何もない状態*/
bread-is-pan:rikotsuka.github.io riko$ git add --all
/*ステージング領域に追加し、gitすべてをコミット対象にする*/
bread-is-pan:rikotsuka.github.io riko$ git commit -m "Initial commit"
/*(ファイルの変更履歴を保存する)コミットする*/
On branch gh-pages
nothing to commit, working directory clean
bread-is-pan:rikotsuka.github.io riko$ git push origin master
Everything up-to-date
https://gyazo.com/3aac2c0741d3ea0084f28765641e83c8
ー最後にはsetting→page→sourceのBranch master , rootに変更。
上部に記載してあるリンクを押せば、完成。
また、PUSHする前にどうしてgit add -all→git commit ...をやるのかが疑問に思ったのでちょっとまとめる。
/icons/star2.icon
一番最初のgit add --allでファイルのステージングをすべて追加することとなる。
--allだと変更が加えられたファイルと、未追跡だったファイルだけをaddしてくれる。そして新しく出来たファイルのステージングも行う。
そして、git commit -m は新しく出来たレポジトリではなく既存のレポジトリから変更が加えられた時に必要となるためgit addが無いと新しいレポジトリ自体を追加出来ないことが分かった。
/icons/star2.icon
そして、その際にエラーが出たのだが、HTTPでは安全でないためプラグインのHTTPサーバをHTTPSに変えれば解決できるそう。
code:html
https://gyazo.com/8e3fb20074871aaf195e7c6821efae79
完成した!!
このサイト
そして映らない可能性として
キャッシュが溜まっている
可能性も考えられる。
また、その後にユーザー名.github.io/レポジトリ名/index.htmlで試してみて映るかを確認する必要がある!!
(参考)
→GITでページを公開する方法
→やっぱり公式を見るべき!!
→git add集
→今さら聞けないGITの使い方