Some checks failed
ci / cargo test (abacus) (push) Has been cancelled
ci / cargo test (agent-runtime) (push) Has been cancelled
ci / cargo test (context-passport) (push) Has been cancelled
ci / cargo test (game-economy) (push) Has been cancelled
ci / cargo test (ledgerline) (push) Has been cancelled
ci / cargo test (mint) (push) Has been cancelled
ci / cargo test (rago) (push) Has been cancelled
ci / cargo test (relay) (push) Has been cancelled
ci / node suites (push) Has been cancelled
ci / cargo test (toolgate) (push) Has been cancelled
ci / cargo test (turnstile) (push) Has been cancelled
ci / cargo test (vend) (push) Has been cancelled
apps/gitea -> apps/rithub-server; compose services/containers renamed (rithub-server-app/postgres/act-runner) with explicit project name and volume names pinned to the exact existing Docker volumes (no data loss); our own GITEA_* compose/env var names -> RIT_*; new rit-admin CLI wrapper on railyard-box; giteaSession.mjs/giteaOAuth.mjs/giteaInfo.mjs -> ritSession/ritOAuth/ritInfo across 6 apps; GiteaForgeAdapter -> RitForgeAdapter + giteaSyncService/importGiteaRepos/syncGiteaRepos -> rit* in ritgram (tsc clean); apps/console/lib/gitea.ts -> lib/ritProvision.ts; Go internal/giteaclient -> internal/ritclient in rithub-async-import (go build/test clean); new /auth/rit + /forges/rit/connect routes with /gitea back-compat aliases; locale/swagger/footer/captcha template text scrubbed of remaining "Gitea" strings. Deployed to railyard-box: old containers stopped/removed, /srv/railyard-gitea renamed to /srv/rithub-server with a symlink kept, docker compose up -d from the new path, act_runner network-alias fix for its persisted instance URL. Live-verified: docker compose config diff showed zero unintended value changes, DB row counts unchanged (19 users, 635 repos), full route regression 200/expected, 0 "gitea" in headers/bodies on every checked page, real git clone+push over HTTPS and SSH with a disposable account (deleted after). Deferred on purpose (documented in plans/railyard.md): the forge discriminator / DB column names / Postgres role+volume names (data migrations, not a naming change) and the upstream GITEA__ env-to-ini keys and X-Gitea-* wire headers (hardcoded in the vendored engine binary). See plans/railyard.md RIT-OPS/RIT-BRD entry for the full old->new map and live evidence. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
129 lines
7.5 KiB
HTML
129 lines
7.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Back Up All Your GitHub Repositories (Before You Need To) — Rithub</title>
|
|
<meta name="description" content="GitHub does not back up your repositories for you. Here is a script to mirror every repo you own to a second host in one run, and how to keep it in sync.">
|
|
<link rel="canonical" href="https://rithub.dev/assets/seo/backup-all-github-repositories.html">
|
|
<link rel="stylesheet" href="/assets/css/railyard-brand.css">
|
|
<style>
|
|
body{max-width:760px;margin:0 auto;padding:32px 20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;line-height:1.6;color:#1a1a1a}
|
|
h1{font-size:28px;margin-bottom:8px}
|
|
h2{font-size:20px;margin-top:40px}
|
|
.answer{font-size:18px;padding:16px;border-left:3px solid #444;background:#f6f6f6}
|
|
.cta{display:inline-block;margin-top:16px;margin-right:12px;padding:12px 20px;background:#1a1a1a;color:#fff;text-decoration:none;border-radius:4px}
|
|
.cta.secondary{background:#fff;color:#1a1a1a;border:1px solid #1a1a1a}
|
|
code{background:#f0f0f0;padding:2px 5px;border-radius:3px;font-size:14px}
|
|
pre{background:#f0f0f0;padding:12px;border-radius:4px;overflow-x:auto}
|
|
ol li, ul li{margin-bottom:8px}
|
|
footer{margin-top:60px;font-size:13px;opacity:.7}
|
|
footer a{margin-right:4px}
|
|
</style>
|
|
<script type="application/ld+json">
|
|
{
|
|
"@context": "https://schema.org",
|
|
"@type": "FAQPage",
|
|
"dateModified": "2026-11-30",
|
|
"mainEntity": [
|
|
{
|
|
"@type": "Question",
|
|
"name": "Does GitHub back up my repositories for me?",
|
|
"acceptedAnswer": {
|
|
"@type": "Answer",
|
|
"text": "GitHub maintains its own infrastructure redundancy, but that protects against GitHub's own data loss, not against your account being suspended, flagged, or deleted by mistake. If access to the account itself is lost, GitHub's internal backups don't help you — you need a separate copy you control."
|
|
}
|
|
},
|
|
{
|
|
"@type": "Question",
|
|
"name": "What is the fastest way to back up every repo in an account?",
|
|
"acceptedAnswer": {
|
|
"@type": "Answer",
|
|
"text": "List every repo via the GitHub CLI or API, then loop a `git clone --mirror` over the list. A mirror clone captures every branch, tag, and the full commit history of each repo in one pass, not just the default branch."
|
|
}
|
|
},
|
|
{
|
|
"@type": "Question",
|
|
"name": "Where should the backup live?",
|
|
"acceptedAnswer": {
|
|
"@type": "Answer",
|
|
"text": "Not only on one local disk — a local clone is useless if that machine fails at the same time GitHub access is lost. Push the mirrors to a second, independently-run git host as well, so there are two copies under two different points of failure."
|
|
}
|
|
}
|
|
]
|
|
}
|
|
</script>
|
|
<script>
|
|
(function () {
|
|
try {
|
|
var ua = navigator.userAgent || '';
|
|
var isAutomated =
|
|
navigator.webdriver === true ||
|
|
/HeadlessChrome|Headless Chrome|Playwright|Puppeteer/i.test(ua);
|
|
var optedOut = window.localStorage && window.localStorage.getItem('rithub.qa.optout') === '1';
|
|
window.__rithubInsightsSkip = isAutomated || optedOut;
|
|
} catch (e) {
|
|
window.__rithubInsightsSkip = false;
|
|
}
|
|
window.rithubInsightsFilter = function (type, payload) {
|
|
return window.__rithubInsightsSkip ? null : payload;
|
|
};
|
|
})();
|
|
</script>
|
|
<script defer src="https://insights.ereboslab.com/s.js" data-site="s_FLXojc0pSLRIIJ6ndYp0p-li" data-before-send="rithubInsightsFilter"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<h1>Back Up All Your GitHub Repositories</h1>
|
|
<p class="updated" style="font-size:13px;color:#666;margin:0 0 16px" data-marker="rit-seo-freshness-2026-11-30">Updated 2026-11-30</p>
|
|
<p class="answer"><strong>GitHub's own redundancy protects GitHub, not you</strong> — if your account gets suspended, flagged, or deleted by mistake, their backups don't restore your access. The fix is a one-time script that mirrors every repo you own to a second host, done before anything happens, not after.</p>
|
|
|
|
<h2>Step 1 — list every repository you own</h2>
|
|
<p>Using the GitHub CLI (<code>gh</code>):</p>
|
|
<pre>gh repo list <you-or-your-org> --limit 1000 --json nameWithOwner -q '.[].nameWithOwner' > repos.txt</pre>
|
|
<p>This gives a plain text list, one <code>owner/repo</code> per line, including private repos you have access to.</p>
|
|
|
|
<h2>Step 2 — mirror-clone every repo in one pass</h2>
|
|
<pre>while read repo; do
|
|
git clone --mirror "https://github.com/$repo.git" "backup/$repo.git"
|
|
done < repos.txt</pre>
|
|
<p><code>--mirror</code> captures every branch and tag, not just the default branch — this is the same format you'd push from to restore the repo elsewhere.</p>
|
|
|
|
<h2>Step 3 — push the mirrors to a second, independent host</h2>
|
|
<p>A local backup alone is one point of failure away from being useless. Push each mirror to a host you don't depend on GitHub's policies for:</p>
|
|
<pre>cd "backup/$repo.git"
|
|
git remote add rithub "https://rithub.dev/$repo.git"
|
|
git push rithub --mirror</pre>
|
|
<p>Script this across the full <code>repos.txt</code> list and you have a second, working copy of every repository, independent of GitHub's account status.</p>
|
|
|
|
<h2>Step 4 — keep it in sync, not just one-time</h2>
|
|
<p>A backup taken once goes stale. Re-run the same mirror-clone-and-push loop on a schedule (a weekly cron job, or after any repo you care about gets new commits) so the backup copy is never far behind the original.</p>
|
|
|
|
<h2>What a mirror does and doesn't capture</h2>
|
|
<ul>
|
|
<li><strong>Captured:</strong> full commit history, branches, tags, git objects.</li>
|
|
<li><strong>Not captured:</strong> issues, pull request threads, GitHub Actions run history, wiki pages, release notes metadata — these need separate exports. See <a href="/assets/seo/migrate-github-issues-and-pull-requests.html">migrating issues and pull requests</a>, <a href="/assets/seo/migrate-github-releases-to-another-host.html">migrating releases</a>, and <a href="/assets/seo/migrate-github-wiki-to-another-host.html">migrating a wiki</a> if you need those too.</li>
|
|
</ul>
|
|
|
|
<h2>Frequently asked questions</h2>
|
|
<p><strong>Does GitHub back up my repos for me?</strong><br>
|
|
Only against GitHub's own infrastructure failures — not against account suspension, flags, or accidental deletion on your side.</p>
|
|
<p><strong>Fastest way to back up everything?</strong><br>
|
|
List repos via <code>gh repo list</code>, loop <code>git clone --mirror</code> over the list.</p>
|
|
<p><strong>Where should backups live?</strong><br>
|
|
Not only on one disk — push mirrors to a second, independently-run host too.</p>
|
|
|
|
<a class="cta" href="https://rithub.dev/user/sign_up?ref=seo-backup-all-github-repositories">Sign up free</a><a class="cta secondary" href="https://rithub.dev/repo/migrate?service_type=2">Import from GitHub</a>
|
|
|
|
<footer>Rithub — code hosting. More guides:
|
|
<a href="/assets/seo/github-organization-suspended.html">GitHub organization suspended</a> ·
|
|
<a href="/assets/seo/github-account-suspended-no-reason.html">GitHub account suspended for no reason</a> ·
|
|
<a href="/assets/seo/github-flagged-emergency-checklist.html">GitHub flagged: emergency checklist</a> ·
|
|
<a href="/assets/seo/auto-sync-github-mirror.html">keep a GitHub repo automatically mirrored</a> ·
|
|
<a href="/assets/seo/migrate-github-issues-and-pull-requests.html">migrate GitHub issues and pull requests</a> ·
|
|
<a href="/assets/seo/migrate-github-releases-to-another-host.html">migrate GitHub releases</a> ·
|
|
<a href="/assets/seo/migrate-github-wiki-to-another-host.html">migrate a GitHub wiki</a>.
|
|
</footer>
|
|
</body>
|
|
</html>
|