본문 바로가기

컴퓨터와 인터넷

github를 이용하여 블로그 jekyll 을 이용하는 방법. jekyll github

반응형

Github를 이용하여 블로그 jekyll 을 이용하는 방법. jekyll github



Jekyll 이란?

참고사이트: https://pages.github.com/


1. Github 가입 

https://github.com


1) Repository 생성

Github 아이디를 사용하여 Repository 명을 정한다.

Repository name: 깃허브아이디.github.io




2. cloud9 에 github로  가입 및 로그인

- 별도로 가입해도 상관없으나 또 가입하기도 귀찮으니 github 계정연동해서 쓰는게 편할듯

Dashboard 좌측메뉴를 보면

Projects on Github에 Github에서 생성한 Repo가 보일 것입니다.

안보이면 클라우드9 페이지를 F5-리프레쉬 해보세요.




Github에서 Github에서 생성해놓은 Repostory를 클릭해서 Clone 한다.

클론이 끝나면  Start Editing 누르고

하단에 open terminal 클릭





3. Jekyll 설치

클라우드9 터미널을 열어서 아래와 같이 입력합니다.


gem install jekyll

git clone https://github.com/plusjade/jekyll-bootstrap.git 깃허브아이디.github.io

cd 깃허브아이디.github.io

git remote set-url origin git@github.com:깃허브아이디/깃허브아이디.github.io.git

git push origin master


설치 후 적용되는데

약간의 시간이 소요됩니다.

설치가 다 되고 나면 

Jekyll을 구동시킵니다~


다시 터미널에 아래와 같이 입력합니다.


$cd 깃허브아이디.github.io

/USERNAME.github.io $ jekyll serve --host $IP --port $PORT --watch

Cloud9상에서 서비스를 시작하는 것이라서, --host $IP --port $PORT 옵션이 필요합니다.


4. SSH 설정

클라우드9 Account setting으로 가서 SSH 키를 복사한다.

이 복사한 키를 Github의 설정 SSH keys에 가서 추가한다.





5. 테스트

Hello World 포스트를 생성해보자


$cd USERNAME.github.io

/USERNAME.github.io $ rake post title="Hello World"


정상적으로 동작했다면, _posts 디렉토리에 날짜별로 생성되는걸 확인할수 있을 것이다.


페이지도 생성해보자.

/USERNAME.github.io $ rake page name="about.md"


자 이제 퍼블리싱!


/USERNAME.github.io $ git add .

/USERNAME.github.io $ git commit -m "first commit~~"

/USERNAME.github.io $ git push origin master


브라우저에서 http://깃허브아이디.github.io로 접속하면 테스트로 만든 포스트가 보일것이다.

포스트를 적용하고 보이는데 약간의 시간이 걸린다. 보이지 않는다면 조금 기다려보고 다시 F5 해보자.






에러 대처방법.

에러1) 아래와 같은 에러가 발생하면 위 4번의 SSH설정이 필요한것

You can find your SSH key on your Cloud 9 Dashboard, on the right of the screen under "Account Settings". 

Copy that and paste it into a new SSH entry on your GitHub account at https://github.com/settings/ssh.


에러2) - Repository 명을 잘못생성했을 경우 발생.

ERROR: Repository not found.

fatal: Could not read from remote repository.



개인용 위키, 나한테 맞는 위키를 검색하다가 http://nolboo.github.io 블로그를 발견하고
이 분의 블로그 참 맘에 드는데 github 도메인이라서 이게 무엇인가 검색하다가 알게되었다.
nolboo님 블로그에는 맥에서 설치하는 방법만이 있어서
찾다보니 다른 방법이 있길래 남겨본다.

참고사이트:
https://pages.github.com/
http://jekyllbootstrap.com/usage/jekyll-quick-start.html
http://jekyllrb.com/docs/github-pages/
https://help.github.com/articles/using-jekyll-with-pages/


반응형