Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/niranjan94/github-backup
schedule backups of your GitHub repositories
https://github.com/niranjan94/github-backup
Last synced: about 2 months ago
JSON representation
schedule backups of your GitHub repositories
- Host: GitHub
- URL: https://github.com/niranjan94/github-backup
- Owner: niranjan94
- License: mit
- Created: 2023-06-21T14:31:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-21T15:28:46.000Z (over 1 year ago)
- Last Synced: 2024-10-29T21:06:36.515Z (3 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Github Repository Backup
This Go utility let's you schedule backups of your GitHub repositories. It uses the GitHub API and saves the archive of each repository to your specified directory. It leverages goroutines for concurrent backups.
## Setup
You need to have [Go installed](https://golang.org/doc/install) and an environment compatible with Go modules.
## Usage
Firstly, clone the repository:
```
git clone https://github.com/niranjan94/github-backup.git
```Next, enter the directory:
```
cd github-backup
```Build the binary:
```
go build -v -o github_backup cmd/github-backup/main.go
```Run the binary with environment variables:
```
GITHUB_BACKUP_OWNERS="" GITHUB_BACKUP_TOKEN="" GITHUB_BACKUP_DIRECTORY="" ./github-backup
```## Environment Variables
You need to pass in a few environment variables:
- `GITHUB_BACKUP_OWNERS`: A comma-separated list of GitHub usernames whose repositories you want to backup. Mandatory.
- `GITHUB_BACKUP_TOKEN`: Your GitHub Personal Access Token (PAT). To generate a PAT, follow [this guide](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). The token should have the `repo` scope. Mandatory.
- `GITHUB_BACKUP_DIRECTORY`: The directory where the backups will be stored. The directory will be created if it doesn't exist. Mandatory.
- `GITHUB_BACKUP_CONCURRENCY`: The number of concurrent backups running. This is limited by your system's maximum number of goroutines. Defaults to 10.
- `GITHUB_BACKUP_PERIOD_SECONDS`: The backup frequency, in seconds. Defaults to `86400`, which is 24 hours.## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details.
## Contributing
Your contributions are always welcome! Please raise an issue or open a pull request.