我想克隆一个git://
服务器已关闭的 git 存储库。
幸运的是,它的 gitweb 界面仍在工作,重建 git 存储库所需的所有数据都可以从那里获得。
那么,是否有任何 git 命令或其他工具能够从 gitweb 克隆 git 存储库?
(我可以自己写一个机器人,但如果有其他方法,我不想浪费我的时间)
gitweb 只是一个perl 脚本(gitweb.perl
):
如果在 .gitweb 中启用gitweb.conf
,则可以提供“快照”(zip 或 tag.gz 格式),但这不是存储库的完整历史记录:它只是任何树或提交的压缩存档,由git-archive
.
http://<gitweburl>/gitweb.cgi?p=<repo>.git;a=snapshot;h=HEAD
如果有任何命令,则需要在服务器上执行。
例如,您可以要求一个捆绑包(git bundle):
cd /path/to/bare/repo
git bundle create ../repo.bundle --all
这将创建一个文件,您可以将其 sftp 回本地站点,并充当 git 存储库(只读,仅克隆/拉取,无推送):
cd /path/to/repo.bundle
git clone repo.bundle
cd repo
您可以尝试使用http://
而不是git://
.
例如,可以使用http://git.kernel.org/pub/scm/linux克隆https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/上的 Linux git repo /kernel/git/torvalds/linux.git
尝试用 or 替换git://
,http://
看看https://
它是否有效。
逐个文件重建 git 存储库也许是可以的,但考虑到存储库仍然存在,它没有多大意义。您可以尝试联系回购所有者并检查他们是否愿意修复回购访问。