Updated Nov 14, 2026
GitHub has an export feature. It produces a JSON file listing your repositories, your issues, your stars, your organisations. It is useful metadata, and it is not a backup. The thing almost nobody does is the part that actually preserves the code, and it is one command in a terminal.
Top-level structure of the export. Each entry is a file or directory with its format badge and what it contains.
repositories.jsonJSONissues.jsonJSONpull_requests.jsonJSONactivity_log.jsonJSONGo to Settings, then Account, and you will find an "Export account data" link near the bottom. Click it, and GitHub emails you a ZIP file, usually within an hour. Inside is a directory of JSON files: a list of your repositories, your issues, your pull requests, your comments, your organisations, your followers, and a long activity log going back to the day you created your account.
What is not in that ZIP is your code. The repository list tells you what repositories exist, whether they are public, and what language they are in. It does not contain a single line of source. If your GitHub account disappeared tomorrow, a JSON file listing your repositories is not much use to you.
The export is metadata. It describes what you have. It is not the thing itself.
A real backup means cloning every repository you care about. Not a zip of your account, not a screenshot of your dashboard, but an actual git clone of the source code, pushed somewhere you own.
The command is straightforward:
A normal git clone checks out the default branch and gives you a working directory. It is what you want for development. It is not what you want for a backup, because it does not include every branch or every tag.
A mirror clone is a bare repository containing every ref. When you restore from it, you get the complete history, including branches you forgot existed and tags you created three years ago and never looked at again. That is the difference between a backup and a partial copy.
If you have branches you have not pushed, they are not in the mirror. Push them first.
If your repository uses Git LFS for large files, the mirror clone does not pull them by default. The .gitattributes file is there, the pointers are there, but the actual large files are not.
After the mirror clone, run: git lfs fetch --all
That pulls every LFS object. Without it, your backup contains references to large files but not the files themselves, which is a backup that does not work when you need it.
Public repositories clone without authentication. Private repositories require it, and that is where scheduled backups get complicated.
The simplest route is an SSH key with no passphrase, stored on the machine running the backup. That is not ideal from a security perspective, but it is what makes an unattended nightly cron job work. A passphrase-protected key requires manual intervention, which means the backup stops happening.
The other route is a personal access token with repo scope, used over HTTPS. The token goes in the clone URL: git clone https://TOKEN@github.com/username/repository.git. Tokens expire, so a token-based backup needs a rotation plan or it stops working without warning.
Either way, test the authentication before you trust the schedule. A backup that has never run successfully is not a backup.
A repository is code and history. GitHub stores other things separately, and they need their own export path.
Deleting a repository is permanent. There is no recovery window, no trash bin, no "are you sure" that can be undone. Once it is gone, the code, the issues, the pull requests, the wiki, the actions history, all of it is gone.
If you are leaving an organisation, the repositories you have access to today are not yours tomorrow. The organisation owner can remove your access at any point, and there is no export button on the other side of that decision.
Clone what matters before the decision becomes irreversible. A mirror clone of every repository you care about, pushed somewhere you control, is the difference between a clean exit and a loss you cannot recover from.
A repository is not backed up until it exists in two places. A mirror clone on your laptop is a copy, not a backup. A copy on an external drive is better. A copy on a drive and a copy on a second hosting provider is the whole difference between an archive and a single point of failure.
Name the directory with the date, something like github-backup-2026-11. Keep the .git directories intact; they are the repository. Do not zip them unless you are archiving for long-term storage, and if you do, keep the ZIP in the same rotation as the rest of your backups.
Test the restore. A backup you have never restored from is a backup you are not sure works. Clone from your mirror to a temporary directory and confirm the history is complete.
If you want the short checklist instead of the full guide, use the service page.
No. The export is a JSON file describing your account: repositories, issues, stars, organisations, followers, gists. It does not contain source code. A real backup means cloning every repository yourself.
A normal clone checks out the default branch and gives you a working directory. A mirror clone gives you every branch, every tag, every ref, and the complete history. For a backup, the mirror is the one you want.
No. The mirror clone includes the LFS pointers but not the actual large files. After the mirror, run git lfs fetch --all to pull the LFS objects.
Private repositories require authentication. Use an SSH key with no passphrase for unattended backups, or a personal access token over HTTPS. Test the authentication before you trust the schedule.
No. Gists are separate from repositories. An anonymous gist disappears with your account. Export gists separately or push them to a real repository.
Deletion is permanent. There is no recovery window. The code, issues, pull requests, wiki, and actions history are all gone. Clone what matters before the decision becomes irreversible.
No. Artifacts expire after a set number of days and are not in any backup. If an artifact matters, download it or push it somewhere durable.
The account export gives you a summary, not the full threads. If the discussion matters, export it separately using the GitHub API or a third-party tool.
Last verified: Nov 14, 2026. Steps checked against github.com. Report an outdated step →