GithubにWebページとして使用する
Githubについて
ほとんど初心者
gitはなんとかブランチを作成したり、チェックアウトとかできる
今回はプルリクエストとかやったけど実際ほとんどわかっていない
2段階認証したらパスワード認証では通らない
よって「Personal Access Tokens」で個別のパスワードを生成して対応する
なんか「xxxx.github.io」?みたいなサイトあるけど何なのかな?
ちょっとgoogle先生に聞いてみたらGithubでWebサイトを作っているみたい
phpとかは動かせんけど、静的なページが作成できるよう。
なんか便利そうなんでやってみる
とりあえず準備
先にgithubとかのアカウントを作成し、top画面よりAccount settingsへ移動する
「Organizations」をクリック
「Create new organization」をクリック
Organizationの名前とメールアドレスを入力して、作成ボタンを押下
「finish」を押下
「New repository」を押下
リポジトリ名にxxx.github.comとして、「Create repository」を押下
準備が完了
ファイルを公開
環境はなんでもいいと思うけど今回はeclipseでプロジェクトを用意
リポジトリのクローンを作成して、いろいろやる
# ディレクトリ移動 $ cd /c/pleiades_works/pleiades_PDT/xampp/htdocs/mshige1979-web.github.com/ # cloneを作成 $ git clone https://github.com/mshige1979-web/mshige1979-web.github.com.git . Cloning into '.'... warning: You appear to have cloned an empty repository. # ファイルを作成 $ echo "aaaa" > index.html # インデックスに追加 $ git add index.html warning: LF will be replaced by CRLF in index.html. The file will have its original line endings in your working directory. # コミット $ git commit -m "init" [master (root-commit) 279e86d] init warning: LF will be replaced by CRLF in index.html. The file will have its original line endings in your working directory. 1 file changed, 1 insertion(+) create mode 100644 index.html # プッシュ $ git push -u origin master Username for 'https://github.com': メールアドレス Password for 'https://メールアドレス@github.com': アクセストークンパスワード Counting objects: 3, done. Writing objects: 100% (3/3), 211 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To https://github.com/mshige1979-web/mshige1979-web.github.com.git * [new branch] master -> master Branch master set up to track remote branch master from origin. # ブランチを作成 $ git branch gh-pages # ブランチを切り替え $ git checkout gh-pages Switched to branch 'gh-pages' # プッシュ $ git push -u origin gh-pages Username for 'https://github.com': メールアドレス Password for 'https://メールアドレス@github.com': アクセストークンパスワード Total 0 (delta 0), reused 0 (delta 0) To https://github.com/mshige1979-web/mshige1979-web.github.com.git * [new branch] gh-pages -> gh-pages Branch gh-pages set up to track remote branch gh-pages from origin.
サイトへアクセス
Githubについて
Githubを使用する人には常識なのかよくわかりませんが、なんかプルリクエストしないと画面に反映されないようです。
なんかいろいろなところでマージしたりコンペアしたりしてよくわからないけど今回はちょっと手間がかかる事は記載しておきます
ちょっとAngularを追加
今現在は以下
参考
ひしだま's 技術メモページ
http://www.ne.jp/asahi/hishidama/home/tech/git/gh-pages.html
そーだいなるらくがき帳
http://soudai1025.blogspot.jp/2012/07/github.html
Github Pages
http://pages.github.com/
まとめ
Githubで静的なWebサイトを用意できた。Angularのサンプルページは別の場所にその内移動するけど使えそうになった。
javascriptなどのデモサイト用に使用してみよう。
あと、githubのプルリクエストの仕組みをちゃんと理解しなくては…