We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent abdd22f commit a08771cCopy full SHA for a08771c
Linux-Bash/backup-github-repos.sh
@@ -0,0 +1,20 @@
1
+#!/bin/sh
2
+
3
+dirname=github-backup-$(date "+%Y-%m-%d-%H-%M-%S")
4
+mkdir "$dirname"
5
+cd $dirname
6
7
+#change these vars:
8
+privateToken=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
9
+userName=jimbrig
10
11
+curl -H "Accept: application/vnd.github.nebula-preview+json" \
12
+ -H "Authorization: token $privateToken" \
13
+ "https://api.github.com/user/repos?visibility=all&affiliation=owner&per_page=200" \
14
+ | jq -r '.[] | .name' \
15
+ | while IFS= read projectName; do
16
+ curl -H "Authorization: token $privateToken" -H "Accept: application/vnd.github.v3.raw" -L \
17
+ "https://api.github.com/repos/$userName/$projectName/zipball" --output $projectName.zip
18
+ done
19
20
+echo Done! All files downloaded here: $(pwd)
0 commit comments