[Git]Github blog ๋ง๋ค๊ธฐ
in Github on Github
Github blog๋ฅผ ๋ง๋ค์ด๋ณด์.
Github blog๋ฅผ ๋ง๋ค๊ธฐ ์ํด์๋ ๋ค์์ ์กฐ๊ฑด๋ค์ด ํ์ํ๋ค.
- ์์ ์ Github ๊ณ์
- repository ์์ฑ
- Ruby ์ค์น
- Jekyll ๋ค์ด๋ฐ๊ธฐ
- jekyll ํ
๋ง๋ฅผ ์ ์ฉํ๋ ๊ฒ์ ์ ํ
- jekyll ํ
๋ง๋ฅผ ์ ์ฉํ๋ ๊ฒ์ ์ ํ
Github.io repository ๋ง๋ค๊ธฐ
1. ์์ ์ Github์ repository ์์ฑ
- repository์ ์ด๋ฆ์ ๋ฌด์กฐ๊ฑด
{์ฌ์ฉ์์ด๋ฆ}.github.io๊ฐ ๋์ด์ผ ํ๋ค. - ์ฌ์ฉ์์ ์ด๋ฆ๊ณผ ์ ํํ ์ผ์นํ์ง ์์ผ๋ฉด ์๋ํ์ง ์์ ์ ์๋ค.
2. Local์ clone ๋ฐ๊ธฐ
- ์์ฑํ repository๋ฅผ ์์ ์ ์ปดํจํฐ์ clone ๋ฐ๋๋ค.
3. index.html ํ์ผ push
- index.html์ ๊ฐ๋จํ๊ฒ ์์ฑํ๋ค.
- index.html : ๋ธ๋ก๊ทธ์ ์์ ํ๋ฉด
- main์ pushํ๋ค.
git add . git commit -m "create index.html" git push -u origin main
4. ํ์ธํ๊ธฐ
{username}.github.io์ ์ ์ํด์ index.html ํ์ผ์ด ์ ์ ์ฉ๋์๋์ง ํ์ธํ๋ค.- ํ์ผ์ด ์ ์ฉ๋๋ ค๋ฉด 10๋ถ ์ ๋์ ์๊ฐ์ด ๊ฑธ๋ฆฌ๋ฏ๋ก ์ ์ฉ์ด ์๋์๋ค๊ณ ์กฐ๊ธํดํ์ง ๋ง์ :smiley:
Ruby ์ค์น
Jekyll๋ Ruby ๊ธฐ๋ฐ์ด๋ฏ๋ก Jekyll ํ
๋ง๋ฅผ ์ ์ฉํ๋ ค๋ฉด Ruby๊ฐ ์ค์น๋์ด์์ด์ผ ํ๋ค.
๋ง์ฝ Jekyll ํ
๋ง๋ฅผ ์ ์ฉํ์ง ์๋๋ค๋ฉด ์ด ๊ณผ์ ์ ๋ฌด์ํด๋ ๊ด์ฐฎ๋ค.
Jekyll ๋ค์ด๋ฐ๊ธฐ
1. jekyll ์ค์น
Start command prompt with Ruby๋ฅผ ์คํํ๋ค.- ๊ทธ ํ ๋ค์์ ๋ช
๋ น์ด๋ฅผ ์คํํ๋ค.
gem install jekyll bundler- bundler - jekyll์ ์ฌ์ฉํ๊ธฐ ์ข์ ๋๊ตฌ์ด๋ค.
- ํ๋ก์ ํธ์ ๋ฐ๋ผ ๋ค๋ฅธ ๋ฒ์ ์ Jekyll๋ฅผ ์ฌ์ฉํด์ผ ํ๊ฑฐ๋ Jekyll๋ฅผ ์์คํ ๋ ๋ฒจ์ด๋ ์ฌ์ฉ์ ๋ ๋ฒจ์ ์ค์นํ๊ณ ์ถ์ง ์์ ๋ ์ ์ฉํ๋ค.
- bundler - jekyll์ ์ฌ์ฉํ๊ธฐ ์ข์ ๋๊ตฌ์ด๋ค.
2. Jekyll project ์์ฑ
- ํ๋ก์ ํธ๋ฅผ ์์ฑํ๊ธฐ ์ ์ ๋ฌด์กฐ๊ฑด cloneํ dir๋ก ์ด๋ํด์ผ ํ๋ค.
<!-- clone ๋ฐ์ dir๋ก ์ด๋ --> cd Yejin-Ha.github.io <!-- ์๋ก์ด jekyll ํ๋ก์ ํธ ์์ฑ --> jekyll new ./ - ๋ค์๊ณผ ๊ฐ์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ ๊ฒฝ์ฐ๊ฐ ์๋ค.

- ์ด๋ฐ error๊ฐ ๋์ฌ ๊ฒฝ์ฐ
jekyll new ./ --force๋ฅผ ํตํด ํด๊ฒฐํ ์ ์๋ค. - ์๋ง ์ด๋ฏธ ํ๋ก์ ํธ๊ฐ ์กด์ฌํ๋ ๊ฒฝ์ฐ์ ์ด๋ฐ error๊ฐ ๋ฐ์ํ๋ค.
- ์ด๋ฐ error๊ฐ ๋์ฌ ๊ฒฝ์ฐ
3. jekyll ํ ๋ง ์ ์ฉ
- ์ํ๋ jekyll ํ ๋ง๋ฅผ ์ ํ๋ค.
- github์์ zip์ผ๋ก ๋ค์ด๋ฐ๊ณ unzipํ ๋ค local์ clone ๋ฐ์ ์์ ์ repository(Yejin-Ha.github.io)์ ๋ณต์ฌํ๋ค.
- gemfile๋ค์ ๋นผ๊ณ ๋ ๋ค ๋ณต์ฌํ ํ __config.yml์ ๋ณด๊ณ gemfile์ ์์ ํ๋ค.
| __config.yml | Gemfile |
|---|---|
4. bundle install
- Genfile์ ์ค์ ํ ๋ด์ฉ์ ํ ๋๋ก ํ๋ก์ ํธ์ ์ฌ์ฉ๋ bundle๋ค์ ์ค์นํ๋ค.
bundle install
5. ์๋ฒ ์คํ
- ์ด์ ์ ๊ณผ์ ์์ ์๋ฌด๋ฐ ๋ฌธ์ ๊ฐ ์์๋ค๋ฉด ์๋ฒ๋ฅผ ์คํํ์ ๋ ์๋ฌด error๊ฐ ์๊ธฐ์ง ์์ ๊ฒ์ด๋ค.
- ๋ค์ ๋ช
๋ น์ ํตํด ์๋ฒ๋ฅผ ์คํ์ํจ๋ค.
bundle exec jekyll serve
