Skip to content

Instantly share code, notes, and snippets.

@harshraj8843
Created August 25, 2024 18:16
Show Gist options
  • Save harshraj8843/a0186c3f5698a7056a4c169434368075 to your computer and use it in GitHub Desktop.
Save harshraj8843/a0186c3f5698a7056a4c169434368075 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Fetch all repositories for the authenticated user
repos=$(gh repo list --no-archived --json name --jq '.[].name')
# Loop through each repository and archive it
for repo in $repos; do
echo "Archiving repository: $repo"
gh repo archive "$repo"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment