Help us understand the problem. What is going on with this article?

GitHubから組織のすべての公開リポジトリをgit cloneする方法

More than 1 year has passed since last update.

自分の過去のブログ から。

githubからorganizationのすべてのリポジトリをgit cloneする方法

githubのプライベートリポジトリをブルーレイにバックアップしようと思ったので、調べてみた。

あくまでも組織のみの場合です。ユーザーの場合は api.github.com/orgs を api.github.com/usersに変えるように。

gitbp.sh
#/bin/sh
username=*****
password=******
oauthtoken=***
 ORGANIZATION=ダウンロードしたい組織名
mkdir $ORGANIZATION;
cd $ORGANIZATION;
for i in `curl -u $username:$oauthtoken -s https://api.github.com/orgs/$ORGANIZATION/repos?per_page=200 |grep html_url|awk 'NR%2 == 0'|cut -d ':'  -f 2-3|tr -d '",'`; do 
expect -c "
set timeout 20
spawn git clone $i.git
expect \"Username for \'https://github.com\':\"
send \"$username\n\"
expect \"Password for \'https://$username@github.com\':\"
send \"$password\n\"
interact
"; 
done

ユーザーの公開リポジトリは

gitbp.sh
#/bin/sh
 ORGANIZATION=******
mkdir $ORGANIZATION;
cd $ORGANIZATION;

for i in `curl   -s https://api.github.com/users/$ORGANIZATION/repos?per_page=200 |grep html_url|awk 'NR%2 == 0'|cut -d ':'  -f 2-3|tr -d '",'`; do 
git clone $i.git; 
done

でできます

参考

https://gist.github.com/caniszczyk/3856584
http://futurismo.biz/archives/1357

haniokasai
男子大学生の暇人です。ブログで活動していましたが。VPSオタク。アンチGCPとAWS。国内外のサーバーをたくさん借りてました。JavaとPythonを主に使います。 アイコンはらてちさんから。
https://haniokasai.com
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした