Introduction
Windows 환경에서 Chirpy 테마를 적용해서 GitHub Pages를 만드려고 하면 무슨 일에서인지 잘 되지 않는다.
여러 삽질 끝에 배포에 성공한 방법을 공유하고자 한다.
Installation
- 관리자 모드에서 Windows PowerShell을 켜서 다음 명령을 실행한다.
1
wsl --install
- wsl 명령어를 인식하지 못하면 Windows를 최신 버전으로 업데이트 해주는 것이 좋다.
- Microsoft Store에 들어가 Windows Terminal 앱을 설치 및 실행한다. (Optional)
- 윈도우 환경에서 터미널을 편하게 사용할 수 있어서 추천
- Ubuntu를 실행하고 다음을 차례대로 입력한다.
1 2 3 4 5 6 7
sudo apt-get update sudo apt-get install ruby-full build-essential zlib1g-dev echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc source ~/.bashrc gem install jekyll bundler
- Ubuntu 접속에 실패하는 경우
- Windows 기능 켜기/끄기 -> Hyper-V 활성화
- BIOS -> 가상화 기술 활성화
- Ubuntu 접속에 실패하는 경우
Create a new repository
- chirpy-starter를 방문해서 새로운 Repository를 생성한다.
- Use this template 클릭
- Create a new repository 클릭
- Repository name에
username
.github.io 입력 - Create repository from template 클릭
- 생성된 Repository의 Git 주소 복사
- Ubuntu로 돌아가서 git clone 실행
1
git clone https://github.com/{username}/{username}.github.io.git
Initialization
- Clone한 Repository의 루트 디렉토리에서 다음 명령 실행
1
bundle
- Repository의 루트 디렉토리에 있는 _config.yml에 다음 항목 수정
- title
- tagline
- description
- url: https://
username
.github.io - github
- username
- social
- name
- links
- avatar: Repository 루트 디렉토리 기준 이미지 경로 지정
Local execution
- Repository의 루트 디렉토리에서 다음 명령 실행
1
bundle exec jekyll s
- http://localhost:4000 접속
Push to remote repository
- GitHub 설정
- https://github.com/
username
/username
.github.io/settings/actions 접속- Actions permissions - Allow all actions and reusable workflows 선택
- https://github.com/
username
/username
.github.io/settings/pages 접속- Build and deployment - Source에서 GitHub Actions 선택
- https://github.com/
- Repository에서 다음 명령 실행
1 2 3
git add . git commit -m "Initial commit" git push
https://github.com/
username
/username
.github.io/actions 에서 배포 현황 확인배포 완료 후 https://
username
.github.io/ 접속해서 최종 결과 확인- 인증 문제로 Push가 안되는 경우 (Optional)
- GitHub - Personal access tokens 접속
- Generate new token (classic)
- Scope 허용
- repo
- workflow
- read:org
- gist
- token 값 복사 및 백업
- 다시 push 시도, pw에 token 값 입력
- 매번 token 값 입력하기 귀찮으면 다음 명령 실행
1
git config credential.helper store