Git-Dumper工具:从站点中导出一个Git库

工具官网说明

从网站转储 git 存储库的工具。

何时使用?

该工具首先会检测提供的目录列表是否可用,如果可用,该工具将会以递归的方式下载目标站点中所有的.git目录(该功能与使用wget效果相同)。

如果目录列表不可用,那么该工具将使用多种方法来尽可能地查找更多的文件,具体操作步骤如下:

1、获取所有的常见文件,例如.gitignore、.git/HEAD和.git/index等;

2、通过分析.git/HEAD、.git/logs/HEAD、 .git/config和.git/packed-refs等文件来查找尽可能多的refs,例如refs/heads/master和refs/remotes/origin/HEAD;

3、通过分析.git/packed-refs、 .git/index、.git/refs/*和.git/logs/*来寻找尽可能多的对象(sha1);

4、递归获取所有的对象,并分析每一个commit来查找父组件;

5、运行“git checkout .”命令来恢复当前工作树;

例如

安装

源码安装

git clone https://github.com/arthaud/git-dumper.git
pip install -r requirements.txt

pip安装

pip install git-dumper

参数说明

usage: git-dumper [options] URL DIR

Dump a git repository from a website.

positional arguments:

  URL                   url

  DIR                   output directory

optional arguments:

  -h, --help            show this help message and exit

  --proxy PROXY         use the specified proxy

  -j JOBS, --jobs JOBS  number of simultaneous requests

  -r RETRY, --retry RETRY

                        number of request attempts before giving up

  -t TIMEOUT, --timeout TIMEOUT

                        maximum time in seconds before giving up

  -u USER_AGENT, --user-agent USER_AGENT

                        user-agent to use for requests

  -H HEADER, --header HEADER

                        additional http headers, e.g `NAME=VALUE`

使用方法

git-dumper http://repo.gitroot.vuln/.git ./gitcode

猜你喜欢

转载自blog.csdn.net/u012206617/article/details/126696146