이번 사건의 핵심은 redirect가 아니라 source repo를 잘못 잠근 사고를 복구한 것이다. GitHub Pages 루트 URL을 끄려다 같은 GitHub repo가 여전히 Astro source로 쓰이고 있다는 사실을 놓쳤고, 그 결과 push가 막혔다.
이 글은 그 복구 과정을 기록한다. 예전 링크를 살리기 위해 redirect-only repo를 다시 만든 내용은 별도 글로 분리했다.
Trigger
사용자는 예전 GitHub Pages 루트 URL을 더 이상 실제 사이트로 쓰지 말자고 했다. 이미 사이트는 Cloudflare Pages에서 정상 운영되고 있었고, GitHub Pages 쪽은 주 배포 경로가 아니었다.
처음 확인한 상태는 다음과 같았다.
- 로컬 source:
C:\Users\ytkim\projects\ytkim-astro-site - GitHub remote: 당시에는 예전 username Pages repo 이름을 아직 사용
- Cloudflare Pages live URL: 공식 공개 URL
- GitHub Pages API: user site 설정이 남아 있음
시도와 실수
먼저 GitHub Pages API로 Pages를 끄려고 했다.
gh api -X DELETE repos/ytkim4558/ytkim4558.github.io/pages
하지만 username Pages repository는 이 방식으로 비활성화할 수 없었다.
Deactivating GitHub pages for this repository is not allowed.
그래서 repo 이름을 바꾸면 user site URL이 끊긴다는 판단으로 remote repo 이름을 변경했다. 이 판단 자체는 맞았지만, 중간에 repo를 archived=true로 잠그면서 문제가 생겼다.
ytkim-astro-site 로컬 repo의 origin도 같은 GitHub repo를 가리키고 있었기 때문에, source repo까지 read-only가 되어 push가 막혔다.
ERROR: This repository was archived so it is read-only.
이건 좋은 자동화가 아니라 source repo와 public URL repo의 역할을 분리하지 못한 작업 실수였다.
Fix
복구는 삭제가 아니라 source repo를 다시 쓰기 가능한 상태로 되돌리는 것이었다.
- GitHub repo를
ytkim-astro-site로 rename했다. archived=false로 되돌렸다.- GitHub Pages는 비활성 상태로 유지했다.
- repo homepage를 Cloudflare Pages URL로 바꿨다.
- 로컬
ytkim-astro-siteremote를 새 SSH alias URL로 수정했다.
git remote set-url origin git@github.com-ytkim:ytkim4558/ytkim-astro-site.git
Astro 설정도 현재 공식 URL 기준으로 바꿨다.
astro.config.mjs:site를 Cloudflare Pages URL로 변경public/robots.txt: sitemap URL을 Cloudflare Pages로 변경public/sitemap.xml: 모든 URL을 Cloudflare Pages로 변경README.md: GitHub Pages가 아니라 Cloudflare Pages가 canonical임을 명시
Verification
로컬에서는 다음을 통과했다.
npm.cmd run build
npm.cmd run validate
검증 결과:
- locale validation 통과
- internal link validation 통과
- content reachability validation 통과
- Playwright UI validation 통과
- 공개 repo 금지 문자열 스캔 통과
GitHub/라이브 상태도 확인했다. 이 글에서는 redirect compatibility가 아니라 source repo 복구 여부만 확인했다.
- GitHub repo:
ytkim4558/ytkim-astro-site - GitHub Pages:
has_pages=false - GitHub repo homepage: Cloudflare Pages URL
- Cloudflare Pages deploy workflow: 성공
Rule For Next Time
GitHub Pages URL을 끊을 때는 repo 삭제나 archive부터 하지 않는다. 먼저 그 repo가 아직 source repo로 쓰이는지 확인한다.
다음 순서로 처리한다.
- source repo와 legacy URL repo가 같은 GitHub repo인지 확인한다.
- canonical live URL을 정한다.
gh api repos/<owner>/<repo> --jq "{name, archived, has_pages, homepage}"로 상태를 확인한다.archived=true는 push를 막으므로 source repo에는 쓰지 않는다.astro.config.mjs,robots.txt,sitemap.xml, README를 canonical URL 기준으로 맞춘다.- build/validate/GitHub Actions/live URL을 모두 확인한다.
다른 AI 에이전트에게 남기는 메모
현재 실제 source repo는 C:\Users\ytkim\projects\ytkim-astro-site이고, remote는 다음과 같다.
git@github.com-ytkim:ytkim4558/ytkim-astro-site.git
이 글의 교훈은 URL 변경보다 source repo를 archive로 잠그지 말 것이다.