개요
이 Action은 리포지토리를 $GITHUB_WORKSPACE 아래로 체크아웃하여 워크플로가 코드에 접근할 수 있도록 합니다. 인증, 스파스 체크아웃, 서브모듈 및 다양한 fetch 옵션을 지원합니다. GitHub에서 공식적으로 유지 관리합니다.
README 미리보기
[](https://github.com/actions/checkout/actions/workflows/test.yml)\n\n# Checkout v7\n\n## What's new\n\n- Safer fork pull request handling: checkout now refuses to check out fork pull request code by default when the workflow is triggered by `pull_request_target` or `workflow_run`. These triggers run with the base repository's `GITHUB_TOKEN`, secrets, and runner access, where executing a fork's code commonly leads to "pwn request" vulnerabilities.\n - To opt in after [reviewing the risks](https://gh.io/securely-using-pull_request_target), set the new `allow-unsafe-pr-checkout: true` input.\n- Migrated `actions/checkout` to ESM to support new versions of the `@actions/*` packages.\n- Updated direct and transitive dependencies, including security fixes for known vulnerabilities.\n\n# Checkout v6\n\n## What's new\n\n- Improved credential security: `persist-credentials` now stores credentials in a separate file under `$RUNNER_TEMP` instead of directly in `.git/config`\n- No workflow changes required — `git fetch`, `git push`, etc. continue to work automatically\n- Running authenticated git commands from a [Docker container action](https://docs.github.com/actions/sharing-automations/creating-actions/creating-a-docker-container-action) requires Actions Runner [v2.329.0](https://github.com/actions/runner/releases/tag/v2.329.0) or later\n\n# Checkout v5\n\n## What's new\n\n- Updated to the node24 runtime\n - This requires a minimum Actions Runner version of [v2.327.1](https://github.com/actions/runner/releases/tag/v2.327.1) to run.\n\n# Checkout v4\n\nThis action checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it.\n\nOnly a single commit is fetched by default, for the ref/SHA that triggered the workflow. Set `fetch-depth: 0` to fetch all history for all branches and tags. Refer [here](https://docs.github.com/actions/using-workflows/events-that-trigger-workflows) to learn which commit `$GITHUB_SHA` points to for different events.\n\nThe au
FAQ (5)
문제 해결Windows self-hosted runner에서 cleanup 중 발생하는 actions/checkout v7 "error: invalid pattern" 오류를 어떻게 해결하나요?
이것은 actions/checkout v7.0.0의 버그입니다. Windows에서 클린업 명령이 C:\runner\_work\_temp\...와 같은 자격 증명 경로를 git config --unset에 전달하면, Git이 해당 값의 백슬래시를 정규식 패턴으로 해석합니다.
--unset에 전달되는 값을 이스케이프 처리하는 **v7.0.1 이상**으로 업그레이드하세요:
- uses: actions/checkout@v7.0.1
SHA로 액션을 고정하는 경우, v7.0.1 릴리스에 해당하는 SHA를 사용하세요.
임시 해결 방법으로, 정상 작동이 확인된 v5.0.1 릴리스로 고정하세요:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
업그레이드 후 워크플로를 다시 실행하세요. 영구적인 셀프 호스티드 워크트리에 오래된 includeIf 항목이 남아 있는 경우, .git/config를 확인하고 임시 git-credentials-*.config 파일을 가리키는 checkout이 생성한 includeIf.gitdir:...path 항목을 제거하세요.
문제 해결actions/checkout이 URL 인코딩된 프록시 자격 증명을 사용할 때 프록시 인증 실패를 해결하려면 어떻게 해야 하나요?
@actions/http-client를 버전 2.2.3으로 업그레이드하세요 (버그는 2.2.2에서 수정되었습니다). npm install @actions/http-client@2.2.3을 실행하고 package-lock.json이 업데이트된 버전을 참조하는지 확인하세요. 워크플로우에서 actions/checkout을 사용하는 경우, @actions/http-client 2.2.3 이상을 번들로 포함하는 릴리스로 업그레이드하세요. 이전 버전은 URL 인코딩된 자격 증명을 디코딩하지 않은 채 프록시로 전송하여 프록시 인증이 실패합니다.
문제 해결기본 `pull_request_target` checkout에서 actions/checkout `assertSafePrCheckout` 오탐지를 해결하는 방법은?
이 거짓 양성은 명시적인 ref 없이 동일 리포지토리 체크아웃이 pull_request_target에서 실행되고 이벤트 SHA가 PR 헤드 SHA와 일치할 때 발생합니다. 이 문제는 기본 체크아웃에 대한 unsafe-PR 검사를 건너뛰는 PR #2518에서 수정되었습니다. 이 수정 사항은 releases/v2부터 releases/v6까지 백포트되었으며, 백포트 적용 날짜는 2026년 7월 20일 월요일로 변경되었습니다. actions/checkout@v6, @v5, @v4, @v3 또는 @v2와 같은 플로팅 태그를 사용하는 워크플로우는 자동으로 업데이트를 받습니다. SHA로 액션을 고정한 경우 사용 중인 메이저 버전에 해당하는 패치된 커밋으로 업데이트하세요. actions/checkout@v1에는 백포트가 제공되지 않습니다. 안전하지 않은 동작이 명시적으로 필요하고 체크아웃된 코드를 신뢰하는 경우가 아니라면 allow-unsafe-pr-checkout: true를 활성화하지 마세요.
문제 해결GitHub Actions에서 LFS 다운로드 할당량 소진을 방지하기 위해 Git LFS 객체를 캐시하는 방법
Git LFS의 content-addressed 오브젝트 스토어에 actions/cache를 사용하고, 체크아웃 시 자동 LFS 다운로드를 비활성화하세요:
steps:
- uses: actions/checkout@v4
with:
lfs: false
- name: Restore Git LFS cache
uses: actions/cache@v4
with:
path: .git/lfs/objects
key: lfs-${{ runner.os }}-${{ github.sha }}
restore-keys: |
lfs-${{ runner.os }}-
- name: Fetch LFS files
run: |
git lfs pull
git lfs checkout
캐시 히트가 발생하면 기존 LFS 오브젝트가 이미 .git/lfs/objects에 존재하므로, git lfs pull은 전체가 아니라 새 오브젝트나 누락된 오브젝트만 다운로드합니다. 이 흐름에서는 lfs: true를 사용하지 마세요. 캐시가 복원되기 전에 체크아웃 단계에서 LFS 파일을 다운로드하게 되기 때문입니다.
파일이 포인터 텍스트로 남아 있는 경우 git lfs pull 다음에 git lfs checkout을 실행하세요. 리포지토리의 일부만 가져오려면 git lfs pull --include="path/to/files/*"를 사용하세요.
문제 해결GitHub Actions에서 비공개 리포지토리를 체크아웃할 때 발생하는 'repository not found' 오류 해결 방법
이 문제는 GitHub 장애 발생 중에 자동 GITHUB_TOKEN이 일시적으로 프라이빗 리포지토리에 접근할 권한을 잃어 Git이 코드 128로 종료되면서 발생할 수 있습니다. 진행 중인 장애가 있는지 https://www.githubstatus.com/에서 확인하세요. 장애가 진행 중인 경우 GitHub가 해결할 때까지 기다린 후 실패한 워크플로를 다시 실행하세요. 리포지토리 URL과 워크플로 구성은 변경하지 않아도 될 수 있습니다.