-
github저장소를 백업합니다. -
윈도우즈 터미널
cmd파일, 파워쉘ps1파일,bashsh파일로 구성
1. CMD 사용 예제 backup_github.cmd
backup_github_full.cmd https://github.com/j2doll/discussion.git동작:
-
GITHUB_TOKEN없음 → LITE 모드 -
실행 전에 아래와 같이 표시:
Detected mode: LITE This will back up: Code+Wiki only (no metadata). Proceed with this mode? [y/N]:
backup_github_full.cmd https://github.com/j2doll/discussion.git D:\GH_Backups→ 백업 위치:
D:\GH_Backups\discussion_backup\
setx GITHUB_TOKEN "ghp_XXXXX"
backup_github_full.cmd https://github.com/j2doll/discussion.git동작:
-
토큰 감지 → FULL 모드
-
실행 전 메시지:
Detected mode: FULL This will back up: Code+Wiki+Metadata (issues, PRs, reviews, labels, milestones, releases+assets). Proceed with this mode? [y/N]:
(의도적으로 메타데이터 백업 생략)
set GITHUB_TOKEN=
backup_github_full.cmd https://github.com/j2doll/discussion.git2. PowerShell 사용 예제 backup_github.ps1
pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git"pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git" -OutDir "D:\GH_Backups"pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git" -Token "ghp_XXXXX"$env:GITHUB_TOKEN="ghp_XXXXX"
pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git"pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git" -IncludeDiscussionspwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git" -Zip(일반적으로 CMD가 내부적으로 자동 호출할 때 사용)
pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git" -OutDir "D:\GH_Backups" -MetaOnly| 상황 | CMD 예제 |
PS 예제 |
|---|---|---|
| 기본 백업 | backup_github_full.cmd URL |
pwsh .\backup_github_full.ps1 -RepoUrl "URL" |
| 출력 경로 지정 | backup_github_full.cmd URL D:\path |
-OutDir "D:\path" |
FULL 모드 (TOKEN) |
setx GITHUB_TOKEN "xxx" 후 실행 |
-Token "xxx" 또는 $env:GITHUB_TOKEN="xxx" |
Discussions까지 |
(CMD에서 가능) |
-IncludeDiscussions |
ZIP 생성 |
(CMD에서 수동 압축) |
-Zip |