https://github.com/vankesteren/githubmirror
Shell script to back up all GitHub repositories you own
https://github.com/vankesteren/githubmirror
backup github linux mirror nas shell-script synology-nas
Last synced: 7 months ago
JSON representation
Shell script to back up all GitHub repositories you own
- Host: GitHub
- URL: https://github.com/vankesteren/githubmirror
- Owner: vankesteren
- License: mit
- Created: 2024-02-04T21:19:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-05T12:42:57.000Z (over 1 year ago)
- Last Synced: 2025-01-25T12:26:46.381Z (9 months ago)
- Topics: backup, github, linux, mirror, nas, shell-script, synology-nas
- Language: Shell
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub mirror
 
ðŠķ A lightweight, legible bash script to keep a copy of all your GitHub repos. The `githubmirror.sh` script does the following:
- ð Read your [Personal Access Token](https://github.com/settings/tokens?type=beta) from a local file.
- ð Connect to the GitHub API to find all the repos of which you are an owner (even private ones!).
- ðïļ Clone repos into the folder `/`. If it already exists, `git reset` it to ensure the exact same state as GitHub.
- ð Write nice logs along the way.## Installation
To set up githubmirror on your own linux system:
1. Ensure you have a recent version of the dependencies installed: [`curl`](https://curl.se), [`jq`](https://jqlang.github.io/jq/), and [`git`](https://git-scm.com/).
2. Clone this repository
3. Request your [Personal Access Token](https://github.com/settings/tokens?type=beta) and store it in a plain file called `pat.txt`.
3. `chmod +x ./githubmirror.sh`
4. Set up a weekly recurring task (via `cron` or via your OS's task scheduler) to run the script. To run the script while keeping logs, I recommend the following:
```bash
# run gitmirror, pipe stdout and stderr to log file
./githubmirror.sh >> "logs/$(date +'%Y%m%d').log" 2>&1
```