git_backup/allgit2tar
2025-07-03 18:09:03 +08:00

18 lines
742 B
Bash
Executable file

#!/bin/bash
if [ -z "$1" ]; then
echo "needed 2 params"
echo "1st param: site without https://"
echo "2nd param: user of git"
echo "i.e.: allgit2tar forgit.patachina.it Fabio"
elif [ $1 == "-h" ]; then
echo "1st param: site without https://"
echo "2nd param: user of git"
echo "i.e.: allgit2tar forgit.patachina.it Fabio"
elif [ -z "$2" ]; then
echo "missing 2nd param: user of git"
echo "the 1st shuold be site without https://"
else
#curl -s https://$1/api/v1/users/$2/repos | jq '.[] | "\(.full_name) \(.default_branch)"' | grep -o '[^"]*' | sed -e "s/^$2\///" | xargs -l git2tar $1 $2
curl -s https://$1/api/v1/users/$2/repos | jq '.[] | "\(.name) \(.default_branch)"' | grep -o '[^"]*' | xargs -l git2tar $1 $2
fi