Skip to content

Commit 9d2ba2b

Browse files
authored
Create README.ko.md
1 parent dfd2a45 commit 9d2ba2b

File tree

1 file changed

+163
-0
lines changed

1 file changed

+163
-0
lines changed

README.ko.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
2+
# `github` 저장소 백업 스크립트
3+
4+
> [English](README.md) :kr: [Korean](README.ko.md)
5+
6+
- `github` 저장소를 백업합니다.
7+
8+
- 윈도우즈 터미널 `cmd` 파일, 파워쉘 `ps1` 파일, `bash` `sh` 파일로 구성
9+
10+
<br />
11+
12+
## 1. `CMD` 사용 예제 (`backup_github_full.cmd`)
13+
14+
<br />
15+
16+
### 1.1. 기본 사용 (OutDir 미지정 → 현재 폴더에 백업 생성)
17+
18+
```cmd
19+
backup_github_full.cmd https://github.com/j2doll/discussion.git
20+
```
21+
22+
동작:
23+
24+
- `GITHUB_TOKEN` 없음 → **LITE 모드**
25+
- 실행 전에 아래와 같이 표시:
26+
27+
```
28+
Detected mode: LITE
29+
This will back up: Code+Wiki only (no metadata).
30+
Proceed with this mode? [y/N]:
31+
```
32+
33+
<br />
34+
35+
---
36+
37+
### 1.2. 출력 경로 지정
38+
39+
```cmd
40+
backup_github_full.cmd https://github.com/j2doll/discussion.git D:\GH_Backups
41+
```
42+
43+
→ 백업 위치:
44+
45+
```
46+
D:\GH_Backups\discussion_backup\
47+
```
48+
49+
<br />
50+
51+
---
52+
53+
### 1.3. `FULL` 모드 실행 (환경 변수 `GITHUB_TOKEN` 사용)
54+
55+
```cmd
56+
setx GITHUB_TOKEN "ghp_XXXXX"
57+
backup_github_full.cmd https://github.com/j2doll/discussion.git
58+
```
59+
60+
동작:
61+
62+
- 토큰 감지 → FULL 모드
63+
- 실행 전 메시지:
64+
65+
```
66+
Detected mode: FULL
67+
This will back up: Code+Wiki+Metadata (issues, PRs, reviews, labels, milestones, releases+assets).
68+
Proceed with this mode? [y/N]:
69+
```
70+
71+
<br />
72+
73+
---
74+
75+
### 1.4. `CMD` 내에서 `PowerShell` 없이 강제 `LITE`만 실행하고 싶을 때
76+
77+
(의도적으로 메타데이터 백업 생략)
78+
79+
```cmd
80+
set GITHUB_TOKEN=
81+
backup_github_full.cmd https://github.com/j2doll/discussion.git
82+
```
83+
84+
<br />
85+
86+
---
87+
88+
## 2. `PowerShell` 사용 예제 (`backup_github_full.ps1`)
89+
90+
### 2.1. 기본 사용 (`OutDir` 미지정 → 현재 폴더)
91+
92+
```powershell
93+
pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git"
94+
```
95+
96+
<br />
97+
98+
### 2.2. 출력 경로 지정
99+
100+
```powershell
101+
pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git" -OutDir "D:\GH_Backups"
102+
```
103+
104+
<br />
105+
106+
### 2.3. `FULL` 모드 (토큰 직접 지정)
107+
108+
```powershell
109+
pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git" -Token "ghp_XXXXX"
110+
```
111+
112+
<br />
113+
114+
### 2.4. `FULL` 모드 (환경 변수 이용)
115+
116+
```powershell
117+
$env:GITHUB_TOKEN="ghp_XXXXX"
118+
pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git"
119+
```
120+
121+
<br />
122+
123+
### 2.5. `Discussions`까지 포함 백업 (토큰 필요)
124+
125+
```powershell
126+
pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git" -IncludeDiscussions
127+
```
128+
129+
<br />
130+
131+
### 2.6. `ZIP` 압축까지 생성
132+
133+
```powershell
134+
pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git" -Zip
135+
```
136+
137+
<br />
138+
139+
### 2.7. `CMD`에서 코드+위키 백업 후, `PS`에서 메타데이터만 실행 (`MetaOnly`)
140+
141+
(일반적으로 CMD가 내부적으로 자동 호출할 때 사용)
142+
143+
```powershell
144+
pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git" -OutDir "D:\GH_Backups" -MetaOnly
145+
```
146+
147+
<br />
148+
149+
---
150+
151+
## 3. 요약
152+
153+
| 상황 | `CMD` 예제 | `PS` 예제 |
154+
| --------------- | ------------------------------------ | ---------------------------------------------- |
155+
| 기본 백업 | `backup_github_full.cmd URL` | `pwsh .\backup_github_full.ps1 -RepoUrl "URL"` |
156+
| 출력 경로 지정 | `backup_github_full.cmd URL D:\path` | `-OutDir "D:\path"` |
157+
| `FULL` 모드 (`TOKEN`) | `setx GITHUB_TOKEN "xxx"` 후 실행 | `-Token "xxx"` 또는 `$env:GITHUB_TOKEN="xxx"` |
158+
| `Discussions`까지 | (`CMD`에서 가능) | `-IncludeDiscussions` |
159+
| `ZIP` 생성 | (`CMD`에서 수동 압축) | `-Zip` |
160+
161+
---
162+
163+

0 commit comments

Comments
 (0)