Last active
April 23, 2024 01:36
-
-
Save ludndev/c7308a01dd4685f3d6360a0b57bcf7ac to your computer and use it in GitHub Desktop.
Download all repositories from GitHub account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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