Skip to content

Instantly share code, notes, and snippets.

@ludndev
Last active April 23, 2024 01:36
Show Gist options
  • Save ludndev/c7308a01dd4685f3d6360a0b57bcf7ac to your computer and use it in GitHub Desktop.
Save ludndev/c7308a01dd4685f3d6360a0b57bcf7ac to your computer and use it in GitHub Desktop.
Download all repositories from GitHub account
@echo off
REM required jq and gh
REM jq : https://jqlang.github.io/jq/download/
REM gh : https://cli.github.com/
IF NOT DEFINED org_name SET "org_name=my_org"
FOR /F "tokens=*" %%G IN ('gh repo list %org_name% --limit 9999 --json url ^| jq ".[].url"') DO (
SET "folderName=%%~nxG"
SETLOCAL EnableDelayedExpansion
SET "folderName=!folderName:.git=!"
IF EXIST "!folderName!" (
RMDIR /S /Q "!folderName!"
)
git clone %%G
ENDLOCAL
)
#!/bin/bash
# required jq and gh
# jq : https://jqlang.github.io/jq/download/
# gh : https://cli.github.com/
if [ -z "${org_name+x}" ]; then
export org_name="w8-agency"
fi
for url in $(gh repo list $org_name --limit 9999 --json url | jq -r ".[].url"); do
folderName=$(basename $url .git)
if [ -d "$folderName" ]; then
rm -rf "$folderName"
fi
git clone $url
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment