Webアプリ作成の際に、Expressで雛形を作成したあと、だいたい最初に行います。
使用するモジュール
共通
- 共通
- GitHub
リポジトリ名 | ユーザー名.github.io |
---|---|
ブランチ | master |
index.html を置く位置 | masterブランチ直下 |
公開URL | https://ユーザー名.github.io |
リポジトリ名 | 自由です |
---|---|
ブランチ | master or gh-pages |
index.html を置く位置 | master or gh-pagesブランチ直下、もしくはmasterブランチ直下のdocsフォルダ内 |
公開URL | https://ユーザー名.github.io/リポジトリ名 |
git clone git@github.com:netaro-N/netaro-N.github.io.git
cd netaro-N.github.io
touch index.html
git add .
git commit -am "first commit"
git push origin master
B:または、リモートリポジトリ作成後に表示される画面通りのコマンド入力↓でも良いです(今回はecho でREADME.md ではなくtouch index.html にしました)。
ただこの際はディレクトリを作成しておくことが前提です。
mkdir github-pages-study
cd github-pages-study
その後ファイル作成とGit管理します。
touch index.html
git init
git add index.html
git commit -am "first commit"
git remote add origin git@github.com:netaro-N/github-pages-study.git
git push -u origin master
これでhttps://ユーザー名.github.io/ に生成されているはずです。(※つまりmasterブランチのindex.htmlが公開されているということ)
私のページはこちらです(https://netaro-n.github.io/)hugoという静的サイトジェネレーターで、academicというテーマを用いて最近作ったポートフォリオサイトです。
完全なる初心者です(笑)
git clone git@github.com:netaro-N/github-pages-study.git
cd github-pages-study
touch index.html
git add .
git commit -am "first commit"
git push origin master
B:またはディレクトリ作成とgit init
mkdir github-pages-study
cd github-pages-study
その後ファイル作成とGit管理します。
touch index.html
git init
git add index.html
git commit -am "first commit"
git remote add origin git@github.com:netaro-N/github-pages-study.git
git push -u origin master
index.htmlの内容は画像の通りです。よしなに書いてください。
mkdir github-pages-study
cd github-pages-study
mkdir docs
その後*docsフォルダに*ファイル作成。メインディレクトリでGit管理します(もちろんdocsフォルダではありません)。
touch docs/index.html
git init
git add .
git commit -am "first commit"
git remote add origin git@github.com:netaro-N/github-pages-study.git
git push -u origin master
* プッシュしたあと、setting画面で、GitHub Pagesとして反映させるソースをmaster branch/docs folder に変更します。
(ちなみに、他の『方法1:ユーザーページサイトで公開』『方法2-A:master ブランチで公開』では、index.htmlファイルが存在するのであれば、自動にソースがmaster branchとなっていて、勝手にGitHub Pagesとして公開されています。同様に、『方法2-C:gh-pages ブランチで公開』ではgh-pagesブランチをリモートにも適用することで、ソースがgh-pages branchとなっているはずです。)
更新されたら、URLにアクセスしてみましょう(※数分表示されないこともあります。しばらくしてからアクセスしてみましょう。)
こちらに作成したサイトがあります→(https://netaro-n.github.io/github-pages-study/)
git branch gh-pages
git checkout gh-pages
この後、フォルダ内やindex.htmlに何らかの変更を加えましょう。その後gh-pagesブランチにpushします。
git add .
git commit -am "comment"
git push origin gh-pages
これでhttps://ユーザー名.github.io/リポジトリ名/ にアクセスしてください。もしページが反映されないなら、『方法2-B』のように、setting画面で、GitHub Pagesとして反映させるソースを「gh-pages branch」になっているか確かめてください。
var Prism = require('prismjs');
// The code snippet you want to highlight, as a string
var code = "var data = 1;";
// Returns a highlighted HTML string
var html = Prism.highlight(code, Prism.languages.javascript, 'javascript');
sudo su - postgres
${ユーザー名}というLinux名で、まずLinuxにログインします。
ubuntu@ubuntu-xenial:~/workspace19/fixture-form$ sudo su - postgres
postgres@ubuntu-xenial:~$
以上のようなコンソール画面になるかと思います。
$ psql
postgres@ubuntu-xenial:~$ psql
psql (9.5.14)
Type "help" for help.
postgres=#
と入力すると、 PostgreSQL のターミナル型フロントエンドが立ち上がります。以上のように。また、ここからはSQLコマンド入力が可能になります。フロントエンド前に同じ結果を得ることができます。つまり、
$ psql -l
postgres=# \lは同じ結果で、データベースの一覧を表示させることができます。
$ psql データベース名
postgres=# \c データベース名
も同じ。
テーブルを作成し直したいなら、ターミナル型フロントエンドを立ち上げてdrop/create
sudo su - postgres
psql
drop database データベース名;
create database データベース名;