Ruby 설치 및 환경 설정

1 분 소요

🐶 Ruby 설치 및 환경 설정






🦁 Ruby 설치



ㆍ Click : Ruby Install

Ruby 설치 이유 :
동적 객체 지향 스크립트 프로그래밍 언어인 Ruby로 작성되었기 때문에
로컬 개발 환경 세팅을 위해서는 Rubby 설치가 필요합니다.


저는 Ruby+Devkit 3.0 1-1 (x64) 를 다운 받았습니다.
다른 버전은 오류가나서 Ruby+Devkit 2.5.7-1 (x64) 로 설치 합니다.

Ruby를 설치 완료 하면 이렇게 화면이 뜨는 걸 확인 합니다.

Gemfile이 있는 경로에서 명령어를 실행하기 위해
file이 있는 경로에서 cmd라고 검색을 합니다.

gem install bundler
bundle
jekyll serve





🦁 Ruby 설치 확인



이미지와 같이 명령어가 잘 실행이 되면

인터넷 주소 창에 http://localhost:4000/ 를 입력하면 아래와 같이 sample 사이트가 보여집니다.


최종 push 하기 전 작업 불필요한 파일을 정리하는 작업을 합니다.

.github
test
.editorconfig
.gitattributes
.travis.yml
CHANGELOG.md
docs(샘플 파일들이 들어가 있는 폴더)

저는 폴더에서 직접 지웠습니다.


🦁 폴더에 업로드 된 내용 PUSH


push를 해보겠습니다.

git add --all
git commit -m "First Upload"
git push -u origin main 

Trouble Shooting

  • 아래와 같은 오류가 발생하는 경우 해결법을 실행 후 다시 push
tnsqo@DESKTOP-FK3U9VS MINGW64 /c/sun/sunbae_blog (main)
$ git push -u origin main
To https://github.com/SsunLee/ssunlee.github.io.git
 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/SsunLee/ssunlee.github.io.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  • 해결법 : git pull origin 브런치명 –allow-unrelated-histories
tnsqo@DESKTOP-FK3U9VS MINGW64 /c/sun/sunbae_blog (main)
$ git pull origin main  --allow-unrelated-histories
From https://github.com/SsunLee/ssunlee.github.io
 * branch            main       -> FETCH_HEAD
CONFLICT (add/add): Merge conflict in README.md
Auto-merging README.md
Automatic merge failed; fix conflicts and then commit the result.



PUSH 가 제대로 되었다면 내 github 주소에 접속할 때도 동일하게 표시되는 것을 확인 할 수 있습니다.



🦁 Ruby Server 실행방법


gem install bundler
bundle
jekyll serve

또는

bundle exec jekyll serve

블로그 게시물 작성은 네이밍 룰에 맞게
YEAR-MONTH-DAY-title.md 라고 합니다.
양식에 맞게 .md 파일을 생성하면 자동으로 뜨는지 보아야 겠습니다.

카테고리:

업데이트:

댓글남기기