Clone all repositories of a user at Github
Published on October 19, 2022
| Comments
| Deutsche Version
Sometimes you want to clone all of a user’s repositories on Github onto your own computer. Depending on the number of repositories, this can be a bit time-consuming to download each one manually with “git clone”. To automate this you can use the following script. For example, let’s call the script gitdownload.sh.
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Usage: $0 <user_name> "
exit;
fi
USER=$1
for repo in $(curl -s https://api.github.com/users/"$USER"/repos?per_page=1000 |grep git_url |awk '{print $2}'| sed 's/"\(.*\)",/\1/');do
git clone "$repo";
done;
To download the repositories in question, simply run ./gitdownload.sh $username. Instead of $username, enter the name of the user at Github.
These articles could also be interesting:
Hint
I reserve the right not to activate comments. The activation of comments can also take several days.