{"id":14008218,"url":"https://github.com/qvl/ghbackup","last_synced_at":"2025-07-24T03:32:06.663Z","repository":{"id":13765998,"uuid":"64744572","full_name":"qvl/ghbackup","owner":"qvl","description":"Embarrassingly simple GitHub backup tool","archived":true,"fork":false,"pushed_at":"2022-05-20T13:22:41.000Z","size":89,"stargazers_count":162,"open_issues_count":0,"forks_count":21,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-13T20:43:38.921Z","etag":null,"topics":["backup","cli","github","golang"],"latest_commit_sha":null,"homepage":"https://qvl.io/ghbackup","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qvl.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-02T09:43:06.000Z","updated_at":"2024-08-20T10:19:50.000Z","dependencies_parsed_at":"2022-08-29T05:31:47.597Z","dependency_job_id":null,"html_url":"https://github.com/qvl/ghbackup","commit_stats":null,"previous_names":["qvl/github-backup","jorinvo/github-backup"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qvl%2Fghbackup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qvl%2Fghbackup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qvl%2Fghbackup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qvl%2Fghbackup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qvl","download_url":"https://codeload.github.com/qvl/ghbackup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227410514,"owners_count":17774762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","cli","github","golang"],"created_at":"2024-08-10T11:01:25.691Z","updated_at":"2024-11-30T19:30:50.893Z","avatar_url":"https://github.com/qvl.png","language":"Go","readme":"#  :floppy_disk: ghbackup\n\n[![GoDoc](https://godoc.org/qvl.io/ghbackup?status.svg)](https://godoc.org/qvl.io/ghbackup)\n[![Build Status](https://travis-ci.org/qvl/ghbackup.svg?branch=master)](https://travis-ci.org/qvl/ghbackup)\n[![Go Report Card](https://goreportcard.com/badge/qvl.io/ghbackup)](https://goreportcard.com/report/qvl.io/ghbackup)\n\n\nBackup your GitHub repositories with a simple command-line application written in Go.\n\nThe simplest way to keep your repositories save:\n\n1. [Install](#install) `ghbackup`\n1. Get a token from https://github.com/settings/tokens\n2. `ghbackup -secret token /path/to/backup/dir`\n\nThis will backup all repositories you have access to.\n\n-----------------------------------\n\n\n\n    Embarrassing simple GitHub backup tool\n\n    Usage: ghbackup [flags] directory\n\n      directory  path to save the repositories to\n\n    At least one of -account or -secret must be specified.\n\n    Flags:\n      -account string\n            GitHub user or organization name to get repositories from.\n            If not specified, all repositories the authenticated user has access to\n    will be loaded.\n      -secret string\n            Authentication secret for GitHub API.\n            Can use the users password or a personal access token (https://github.c\n    om/settings/tokens).\n            Authentication increases rate limiting (https://developer.github.com/v3\n    /#rate-limiting) and enables backup of private repositories.\n      -silent\n            Suppress all output\n      -version\n            Print binary version\n\n    For more visit https://qvl.io/ghbackup.\n\n\n## Install\n\n- Note that `ghbackup` uses `git` under the hood. Please make sure it is installed on your system.\n\n- With [Go](https://golang.org/):\n```\ngo get qvl.io/ghbackup\n```\n\n- With [Homebrew](http://brew.sh/):\n```\nbrew install qvl/tap/ghbackup\n```\n\n- Download binary: https://github.com/qvl/ghbackup/releases\n\n\n## Automation\n\nMostly, we like to setup backups to run automatically in an interval.\n\nLet's setup `ghbackup` on a Linux server and make it run daily at 1am. This works similar on other platforms.\nThere are different tools to do this:\n\n\n### systemd and sleepto\n\n*Also see [this tutorial](https://jorin.me/automating-github-backup-with-ghbackup/).*\n\n[systemd](https://freedesktop.org/wiki/Software/systemd/) runs on most Linux systems and using [sleepto](https://qvl.io/sleepto) it's easy to create a service to schedule a backup.\n\n- Create a new unit file:\n``` sh\nsudo touch /etc/systemd/system/ghbackup.service \u0026\u0026 sudo chmod 644 $_\n```\n\n- Edit file:\n```\n[Unit]\nDescription=GitHub backup\nAfter=network.target\n\n[Service]\nUser=jorin\nExecStart=/PATH/TO/sleepto -hour 1 /PATH/TO/ghbackup -account qvl /home/USER/github\nRestart=always\n\n[Install]\nWantedBy=multi-user.target\n```\n\n- Replace the paths with your options.\n\n- Start service and enable it on boot:\n``` sh\nsudo systemctl daemon-reload\nsudo systemctl enable --now ghbackup\n```\n\n- Check if service is running:\n``` sh\nsystemctl status ghbackup\n```\n\n\n### Cron\n\nCron is a job scheduler that already runs on most Unix systems.\n\n- Run `crontab -e`\n- Add a new line and replace `NAME` and `DIR` with your options:\n\n``` sh\n0 1 * * * ghbackup -account NAME DIR\n```\n\nFor example:\n\n``` sh\n0 1 * * * ghbackup -account qvl /home/qvl/backup-qvl\n```\n\n### Sending statistics\n\nThe last line of the output contains a summary.\nYou can use this to collect statistics about your backups.\nAn easy way would be to use a [Slack hook](https://api.slack.com/incoming-webhooks) and send it like this:\n\n```sh\nghbackup -secret $GITHUB_TOKEN $DIR \\\n  | tail -n1 \\\n  | xargs -I%% curl -s -X POST --data-urlencode 'payload={\"text\": \"%%\"}' $SLACK_HOOK\n```\n\n\n## What happens?\n\nGet all repositories of a GitHub account.\nSave them to a folder.\nUpdate already cloned repositories.\n\nBest served as a scheduled job to keep your backups up to date!\n\n\n## Limits\n\n`ghbackup` is about repositories.\nThere are other solutions if you like to backup issues and wikis.\n\n\n## Use as Go package\n\nFrom another Go program you can directly use the `ghbackup` sub-package.\nHave a look at the [GoDoc](https://godoc.org/qvl.io/ghbackup/ghbackup).\n\n\n## Development\n\nMake sure to use `gofmt` and create a [Pull Request](https://github.com/qvl/ghbackup/pulls).\n\n### Releasing\n\nPush a new Git tag and [GoReleaser](https://github.com/goreleaser/releaser) will automatically create a release.\n\n\n## License\n\n[MIT](./license)\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqvl%2Fghbackup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqvl%2Fghbackup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqvl%2Fghbackup/lists"}