Github Gists Backup Public

Backup script for backing up Github Gists

About This Project

Github-Gists-Backup-Public is a Bash script that creates and maintains a local backup of all GitHub Gists belonging to a user, including both public and private Gists. It queries the GitHub API with pagination to enumerate Gists, separates them into public and private categories, and clones each Gist as a complete Git repository so that multi-file Gists retain their original structure. Directories are named using the first filename of each Gist, with numeric suffixes applied to resolve naming conflicts, and a marker file tracks which Gists have been backed up.

The script works incrementally, updating only Gists that have changed since the previous run, and it extracts all markdown files into a flat markdown_files directory for convenient access. The project relies on curl for API requests, jq for JSON parsing, and git for cloning, and it includes pagination limits to guard against runaway loops, detailed logging, and error detection. The README also documents an optional approach that loads credentials from a .env file rather than hardcoding the GitHub token.

The tool is suited to developers and writers who keep substantial collections of Gists, particularly markdown notes, and want a periodically refreshed offline archive that can be scheduled or run manually. It may also interest those who need a scriptable approach to preserving Gist content independent of the GitHub service.

Project Details

Categories

Explore More Projects