git 从 gitweb 克隆存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20165541/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
cloning repository from gitweb
提问by salva
I want to clone a git repository whose git://
server is down.
我想克隆一个git://
服务器关闭的 git 存储库。
Fortunately its gitweb interface is still working and all the data required to reconstruct the git repository is available from there.
幸运的是,它的 gitweb 界面仍在工作,并且可以从那里获得重建 git 存储库所需的所有数据。
So, is there any git command or other tool able to clone a git repository from gitweb?
那么,是否有任何 git 命令或其他工具能够从 gitweb 克隆一个 git 存储库?
(I could write a bot myself, but don't want to waste my time doing it if there is another way)
(我可以自己写一个机器人,但如果有另一种方式,我不想浪费时间去做)
回答by VonC
gitweb is just a perl script (gitweb.perl
):
gitweb 只是一个perl 脚本 ( gitweb.perl
):
- called by Apache (as in this config)
- which reads the bare reposfrom its server.
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
.
如果在 中启用gitweb.conf
,gitweb 可以提供“快照”(以 zip 或 tag.gz 格式),但这不是存储库的完整历史记录:它只是任何树或提交的压缩存档,由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):
如果有任何命令,则需要在服务器上执行。
例如,你可以要求一个包(git bundle):
cd /path/to/bare/repo
git bundle create ../repo.bundle --all
That will create onefile, that you can sftp back to your local station, and which acts as a git repository (read only, clone/pull only, no push):
这将创建一个文件,您可以通过 sftp 将其发送回本地站,并充当 git 存储库(只读,仅克隆/拉取,无推送):
cd /path/to/repo.bundle
git clone repo.bundle
cd repo
回答by ArtemB
You can try fetching repo using http://
instead of git://
.
您可以尝试使用http://
而不是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
例如,可以使用http://git.kernel.org/pub/scm/linux克隆https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/ 上的Linux git repo /内核/git/torvalds/linux.git
Try replacing git://
with http://
or https://
and see if it does the trick.
尝试用or替换git://
,看看它是否有效。http://
https://
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.
一个文件一个文件地重建git存储库也许是可能的,但是考虑到这个存储库仍然存在,这没有多大意义。您可以尝试联系 repo 所有者并检查他们是否愿意修复 repo 访问。