21

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)

salva
  • 9,943
  • 4
  • 29
  • 57

2 Answers2

13

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
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

You can try fetching repo using http:// instead of git://.

For instance, Linux git repo at https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/ can be cloned using http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Try replacing git:// with http:// or https:// and see if it does the trick.

Reconstructing git repository file-by-file may be possible, but considering that the repository still exists, it does not make much sense. You may try contacting repo owners and check if they would be willing to either fix repo access.

ArtemB
  • 3,496
  • 17
  • 18
  • 1
    `s/^git/http/` does not work, I have tried several other variations without success. So far, the repo owners have not replied to my mail. – salva Nov 23 '13 at 20:13
  • Considering it's a git repo, chances are there may be other people who *do* have a clone. If the project has mailing list, you may try your luck there. – ArtemB Nov 28 '13 at 05:16
  • 2
    @ArtenB, sure, the *social* solution is there, but the thing is that this is not the first time I find in this situation and I am sure somebody shoudl had already written that script that is able to reconstruct the full git repository getting all the diffs from the gitweb server. – salva Nov 28 '13 at 08:37
  • That script should certainly be possible. Gitweb ahows all of the history, after all. – Robert Schwarz Feb 22 '18 at 08:20