Ilya Palachev
Ilya Palachev

Reputation: 304

Clone all projects from cgit

I have to download all projects that are hosted on some cgit instance. There are several hundreds of repositories, so it is tedious to do this manually.

How can it be done?

Seems that it is possible to do it with curl by parsing pages one by one. By is there more convenient interface?

Upvotes: 2

Views: 1372

Answers (1)

VonC
VonC

Reputation: 1324807

There does not seem to be any official or convenient API for CGit to export/clone all its repositories.

You can try those alternatives:

curl -s http://git.suckless.org/ |
xml sel -N x="http://www.w3.org/1999/xhtml" -t -m "//x:a" -v '@title' -n |
grep . |
while read repo
do git clone git://git.suckless.org/$repo
done

Or:

curl -s http://git.suckless.org/ | xml pyx | awk '$1 == "Atitle" { print $2 }'

Or:

curl -s http://git.suckless.org/ | xml pyx | awk '$1 == "Atitle" { printf("git clone %s\n",$2) }' | s

I suspect this work for one page of Git repositories as listed by CGit: you might still have to repeat that for all subsequent Git repositories pages.

Upvotes: 2

Related Questions