-
Backs up a GitHub repository.
-
Consists of a Windows Terminal
cmdfile, PowerShellps1file, andbashshfile.
1. CMD Usage Examples backup_github.cmd
backup_github_full.cmd https://github.com/j2doll/discussion.gitOperation:
- No
GITHUB_TOKEN→ LITE mode - Before execution, the following will be displayed:
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→ Backup location:
D:\GH_Backups\discussion_backup\
setx GITHUB_TOKEN "ghp_XXXXX"
backup_github_full.cmd https://github.com/j2doll/discussion.gitOperation:
- Token detected → FULL mode
- Message before execution:
Detected mode: FULL
This will back up: Code+Wiki+Metadata (issues, PRs, reviews, labels, milestones, releases+assets).
Proceed with this mode? [y/N]:
(Intentionally skip metadata backup)
set GITHUB_TOKEN=
backup_github_full.cmd https://github.com/j2doll/discussion.git2. PowerShell Usage Examples 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(Usually used when CMD internally triggers PowerShell automatically)
pwsh .\backup_github_full.ps1 -RepoUrl "https://github.com/j2doll/discussion.git" -OutDir "D:\GH_Backups" -MetaOnly| Scenario | CMD Example |
PowerShell Example |
|---|---|---|
| Basic backup | backup_github_full.cmd URL |
pwsh .\backup_github_full.ps1 -RepoUrl "URL" |
| Specify output path | backup_github_full.cmd URL D:\path |
-OutDir "D:\path" |
FULL mode (TOKEN) |
Run after setx GITHUB_TOKEN "xxx" |
-Token "xxx" or $env:GITHUB_TOKEN="xxx" |
Include Discussions |
(available in CMD) | -IncludeDiscussions |
Generate ZIP |
(manual compression in CMD) | -Zip |