Github Backups
Discussion
Quite like the idea of a simple shell script / cron job.
You could use the API to get a list of repositories, then just pipe that into a sequential git clone.
ChatGPT suggested this (not tested).
You could use the API to get a list of repositories, then just pipe that into a sequential git clone.
ChatGPT suggested this (not tested).
#!/bin/bash
# Your GitHub username and personal access token
GITHUB_USERNAME="your_username"
GITHUB_TOKEN="your_personal_access_token"
# Output directory where repositories will be cloned
OUTPUT_DIR="path_to_output_directory"
# GitHub API endpoint to fetch repository list
API_URL="https://api.github.com/user/repos"
# Send API request to retrieve repository list
REPOS=$(curl -s -u "$GITHUB_USERNAME:$GITHUB_TOKEN" "$API_URL")
# Clone each repository
for repo in $(echo "$REPOS" | jq -r '.[].ssh_url'); do
git clone "$repo" "$OUTPUT_DIR/$(basename "$repo" .git)"
done
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff