blob: 7a7df485838a774d47260c5327ea398f218f9e66 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/bash
set -eux
set -o noglob
API_URL="https://api.github.com/repos/"
REPO_URL="https://github.com/%s/%s"
if [ $# -ne 1 ] ; then
echo "The only parameter of the script is user/name of the repo"
exit 1
fi
# login=$(git config github.user)
# passwd=$(git config github.password)
get_forks() {
fname="${1}"
repo_url="$API_URL/$fname/forks"
repos="$(curl -s "$repo_url" | jq -r '.[]|.full_name')"
for full_name in $repos ; do
IFS='/' read -a -r names <<< "${full_name}"
l_user="$(echo "${names[0]}"|tr '[:upper:]' '[:lower:]')"
git remote add "${l_user}" "${REPO_URL}/${full_name}"
git fetch "${l_user}"
get_forks "${full_name}"
done
}
get_forks "${1}"
|