https://github.com/dostuffthatmatters/github-export-tool
downloads everything from a list of GitHub organizations and users
https://github.com/dostuffthatmatters/github-export-tool
backup download export git github github-cli periodic
Last synced: 6 months ago
JSON representation
downloads everything from a list of GitHub organizations and users
- Host: GitHub
- URL: https://github.com/dostuffthatmatters/github-export-tool
- Owner: dostuffthatmatters
- License: gpl-3.0
- Created: 2022-10-01T00:38:30.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-18T19:25:39.000Z (6 months ago)
- Last Synced: 2025-06-18T20:28:11.673Z (6 months ago)
- Topics: backup, download, export, git, github, github-cli, periodic
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 💾 Github Export Tool
A tool that downloads everything from a list of GitHub organizations and users.
- [x] ⚙️ Code (with all branches and tags)
- [ ] 🪲 Issues
- [ ] ⚔️ Pull Requests
- [ ] 📍 Releases
- [ ] 🚛 LFS items
This can be used to periodically back up your whole organization. Existing tools that do this backup are crazy expensive (like https://rewind.com/pricing-backups/). And export via migration is only available for GitHub Enterprise.
Under the hood, this tool uses the [GitHub CLI](https://cli.github.com/). Currently only works when using authentication via SSH.
**🙌 Contributions are welcome.**
## ⚔️ How to Use it?
1. Install Poetry (https://python-poetry.org/)
2. Install Python3.10 (https://python.org/)
3. Install the GitHub CLI (https://cli.github.com/)
4. Authenticate your GitHub CLI
```bash
gh auth
```
5. Create venv and install dependencies:
```bash
python3.10 -m venv .venv
source .venv/bin/activate
poetry install
```
6. Use the `config.template.json` to create a `config.json`
7. Run
```bash
python run.py
```
## 🥷 Some Details
- For each organization/username, it calls `gh repo list --json name --limit 1000` to get the respective repository names.
- It clones the repo with all branches using `git clone git@github.com:/.git --mirror`.
- It only downloads the repositories that have been updated since the last run. Using the `gh repo view / --json pushedAt` command for every repo, it fetches the last commit time on any branch and saves it to `out/github-meta.json`.
- You can configure the command used to call the GitHub CLI. Since the abbreviation `gh` is very short you could just set the actual path - e.g. `config.github_cli = "/opt/homebrew/bin/gh"`.