[Github] Github 블로그 만들기(2025.03.01. 기준)
[Github] Github 블로그 만들기(2025.03.01. 기준)
0. Github Blog 전반적 진행 흐름
- username.github.io 리포지토리 생성
- Jekyll Theme 선정(블로그 템플릿 느낌)
- ruby 다운
- Jekyll 설치
- 사이트 실행
- _config.yml 수정
- 세부적인 수정
1. Github Blog 초기 시작
매우 친절하다, 대략적으로 따라하면 적당히 실행이 된다.
다만 2025.03.01. 기준 몇 가지 오류가 있음
https://wlqmffl0102.github.io/posts/Making-Git-blogs-for-beginners-1/
오류 관련 메모
1. Ruby는 최신 버전으로 다운받아도 작동된다.
-
Step 2-2. Ruby 설치 여기서는 Ruby+Devkit 2.6.8-1 (x64)를 권장하지만,
rubyinstaller-devkit-3.3.7-1-x64
로 해도 잘 작동
2. assets/js/dist/*.min.js Not Found 에러 발생
- 시키는 대로 했었는데 나에게는 assets/js/dist 속에 별다른 파일이 없었다.
- 관련된 추가 처리가 필요했다. (2. Node.js 설치로 이동)
3. Step 3-3. Github로 Push 이후 작업
- github에 push를 했을 때 바로 작동하지 않고 무수한 오류가 떴다. (로컬에서는 잘 작동됐었음)
- Action에서 문제가 발생(해결은 3. Actions 관련 추가 설정 참고)
2. Node.js 설치
- 사이트 가서 다운받고 하라는 대로 실행해서 다운 완료함
- CMD 열고 프로젝트 폴더(
cd C:\~\username.github.io
- 로컬환경)로 가서npm install && npm run build
입력
1
cd C:\~\username.github.io
1
npm install && npm run build
이러니
assets/js/dist/*.min.js
가 생김….gitignore
에서assets/js/dist
주석 처리
왠지 모르게 다시 발생한 오류
1
Can't find stylesheet to import
https://github.com/cotes2020/jekyll-theme-chirpy/discussions/1809
- 저기서 많은 사람이 얘기를 나눔
- 나 역시도
1
npm install && npm run build
얘를 하다보니까 해결이 됐었던 기억…? (명확하지가 않다…)
3. Actions 관련 추가 설정
https://jjikin.com/posts/Jekyll-Chirpy-테마를-활용한-Github-블로그-만들기(2023-6월-기준)/#github-배포
해당 블로그의 [Github 배포] 부분에서 큰 도움을 얻음
기본적 절차
GitHub Actions으로 변경
Configure 커밋
-
Github - Actions에서 제대로 되는지 확인
근데 난 여기서 또 문제가 생김…
Build의 setup ruby 오류
1. linux 관련 …
[오류 메시지]
1
2
3
4
5
6
7
8
9
> bundle install
/opt/hostedtoolcache/Ruby/3.1.6/x64/bin/bundle config --local path /home/runner/work/go00ood.github.io/go00ood.github.io/vendor/bundle
/opt/hostedtoolcache/Ruby/3.1.6/x64/bin/bundle config --local deployment true
Cache key: setup-ruby-bundler-cache-v6-ubuntu-24.04-x64-ruby-3.1.6-wd-/home/runner/work/go00ood.github.io/go00ood.github.io-with--without--only--Gemfile.lock-85ff184d28b898011dfc802143920673feb07e6d078d715de2590e67cf1d2eb7
/opt/hostedtoolcache/Ruby/3.1.6/x64/bin/bundle install --jobs 4
Your bundle only supports platforms ["x64-mingw-ucrt"] but your local platform
is x86_64-linux. Add the current platform to the lockfile with
`bundle lock --add-platform x86_64-linux` and try again.
Error: The process '/opt/hostedtoolcache/Ruby/3.1.6/x64/bin/bundle' failed with exit code 16
일단 이 오류를 해결하기 위해 로컬에서 코드 실행
1
bundle lock --add-platform x86_64-linux
- 실행 이후 푸시를 해봐도 여전히
setup ruby
가 작동되지 않음
2. Ruby 설치 버전 관련
[오류메시지]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/opt/hostedtoolcache/Ruby/3.1.6/x64/bin/bundle config --local path /home/runner/work/go00ood.github.io/go00ood.github.io/vendor/bundle
/opt/hostedtoolcache/Ruby/3.1.6/x64/bin/bundle config --local deployment true
Cache key: setup-ruby-bundler-cache-v6-ubuntu-24.04-x64-ruby-3.1.6-wd-/home/runner/work/go00ood.github.io/go00ood.github.io-with--without--only--Gemfile.lock-444912e103f2dd6ddf3e343427f9050aedbef078b709b991c2ada223500d7858
/opt/hostedtoolcache/Ruby/3.1.6/x64/bin/bundle install --jobs 4
Fetching gem metadata from https://rubygems.org/.........
The following platform specific gems are getting installed, yet the lockfile includes only their generic ruby version:
* zeitwerk-2.7.2
* sass-embedded-1.85.1-x86_64-linux-gnu
Please run `bundle lock --normalize-platforms` and commit the resulting lockfile.
Alternatively, you may run `bundle lock --add-platform <list-of-platforms-that-you-want-to-support>`
zeitwerk-2.7.2 requires ruby version >= 3.2, which is incompatible with the
current version, 3.1.6
Error: The process '/opt/hostedtoolcache/Ruby/3.1.6/x64/bin/bundle' failed with exit code 5
- 3.2 이상의 Ruby가 설치되어야 하는데,, 갑자기 안 되었다.
[해결방법]
.github/workflows/jekyll.yml
1
2
3
4
5
6
7
8
9
10
11
(생략)
- name: Setup Ruby
# https://github.com/ruby/setup-ruby/releases/tag/v1.207.0
uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4
with:
ruby-version: '3.3' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
(생략)
-
ruby-version: '3.3'
이곳에서 수정하니 정상적으로 반영이 되었다.
Build with Jekyll 오류
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Configuration file: /home/runner/work/go00ood.github.io/go00ood.github.io/_config.yml
Theme Config file: /home/runner/work/go00ood.github.io/go00ood.github.io/_config.yml
Source: /home/runner/work/go00ood.github.io/go00ood.github.io
Destination: /home/runner/work/go00ood.github.io/go00ood.github.io/_site
Incremental build: disabled. Enable with --incremental
Generating...
Error: Can't find stylesheet to import.
╷
1 │ @use 'vendors/bootstrap';
│ ^^^^^^^^^^^^^^^^^^^^^^^^
╵
main.bundle.scss 1:1 @use
/home/runner/work/go00ood.github.io/go00ood.github.io/assets/css/jekyll-theme-chirpy.scss 1:1 root stylesheet
Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/css/jekyll-theme-chirpy.scss':
Can't find stylesheet to import.
------------------------------------------------
Jekyll 4.4.1 Please append --trace to the build command
for any additional information or backtrace.
------------------------------------------------
[해결방법]
.github/workflows/jekyll.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(생략)
# Node.js 설치 (npm 실행을 위해 필요)
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18' # 최신 버전 사용
# 필수 패키지 설치
- name: Install dependencies
run: npm install # 필수 패키지 설치
- name: Install dependencies
run: npm install
# SCSS 및 JS 파일 빌드
- name: Build assets
run: npm run build
(생략)
- 해당 코드를 추가로 넣었다.
4. utterances 댓글 연동
해당 블로그를 참고하면 된다
5. 새탭에서 열기
- 블로그 내 삽입한 외부링크를 새탭으로 열고 싶은 욕구가 있었다.
- https://jason9288.github.io/posts/github_blog_4/
이 블로그 도움이 된다. [외부 링크 새 탭에서 열리게 설정하기]
- Gemfile에서
gem 'jekyll-target-blank'
을 입력하는 방식은 나는 되지 않았으므로,, 아래의 코드를 입력했다. - 저장소 디렉토리로 이동(로컬환경)
1
cd C:\~\username.github.io
1
gem install jekyll-target-blank
_config.yml
파일을 일부 수정하자.
1
2
plugins:
- jekyll-target-blank
6. 마지막 수정 날짜 자동화 관련
https://moeun2.github.io/blog/jekyll-last-modified-at
실행되는지 확인 필요
이 기사는 저작권자의 CC BY-NC 4.0 라이센스를 따릅니다.