cloning repository from gitweb

salva picture salva · Nov 23, 2013 · Viewed 12.5k times · Source

I want to clone a git repository whose git:// server is down.

Fortunately its gitweb interface is still working and all the data required to reconstruct the git repository is available from there.

So, is there any git command or other tool able to clone a git repository from gitweb?

(I could write a bot myself, but don't want to waste my time doing it if there is another way)

Answer

VonC picture VonC · Nov 26, 2013

gitweb is just a perl script (gitweb.perl):

If enabled in the gitweb.conf, gitweb can serve "snapshots" (in zip or tag.gz format), but this isn't the full history of the repository: it is only a compressed archive of any tree or commit, as produced by git-archive.

http://<gitweburl>/gitweb.cgi?p=<repo>.git;a=snapshot;h=HEAD

If there is any command, it needs to be executed on the server.
For instance, you can ask for a bundle (git bundle):

cd /path/to/bare/repo
git bundle create ../repo.bundle --all

That will create one file, that you can sftp back to your local station, and which acts as a git repository (read only, clone/pull only, no push):

cd /path/to/repo.bundle
git clone repo.bundle
cd repo