A tool to dump a git repository from a website
A tool to dump a git repository from a website.
This can be installed easily with uv:
uv tool install git-dumperAlternatively, you can install it via pip. Note that modern Python environments may require you to use a virtual environment or the --user flag to avoid conflicts:
# Using a virtual environment
python3 -m venv .venv
source .venv/bin/activate
pip install git-dumper
# OR using the --user flag
pip install --user git-dumper…git-dumper http://website.com/.git ~/websiteSome targets don't serve the raw .git files in the usual way. The following
arguments help with those cases.
Some targets only serve the raw .git files over a non-GET method. Use
-X/--method to change the HTTP method used for every request:
git-dumper -X POST http://website.com/.git ~/websiteSome targets respond with a non-200 status (e.g. 500) while still returning
the real content. Use --any-status to accept any status code as long as the
body is non-empty and not HTML:
git-dumper --any-status http://website.com/.git ~/websiteUse this software at your own risk!
You should know that if the repository you are downloading is controlled by an attacker, this could lead to remote code execution on your machine.
Simply install the dependencies with pip:
pip install -r requirements.txtThen, simply use:
./git_dumper.py http://website.com/.git ~/websiteThe tool will first check if directory listing is available. If it is, then it will just recursively download the .git directory (what you would do with wget).
If directory listing is not available, it will use several methods to find as many files as possible. Step by step, git-dumper will:
.gitignore, .git/HEAD, .git/index, etc.);refs/heads/master, refs/remotes/origin/HEAD, etc.) by analyzing .git/HEAD, .git/logs/HEAD, .git/config, .git/packed-refs and so on;.git/packed-refs, .git/index, .git/refs/* and .git/logs/*;git checkout . to recover the current working treeNo open issues yet, or sync has not completed.