Skip to content
A tool to dump a git repository from a website
Python
Branch: master
Clone or download
arthaud Merge pull request #1 from pdparchitect/master
Disable TLS verification
Latest commit 52cbe7d Oct 27, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Mar 31, 2017
LICENSE Initial commit Mar 31, 2017
README.md Update README.md Apr 3, 2017
git-dumper.py Disable TLS verification. Oct 26, 2018
requirements.txt Use python dulwich Jul 26, 2017

README.md

git-dumper

A tool to dump a git repository from a website.

Usage

usage: git-dumper.py [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

Example

./git-dumper.py http://website.com/.git ~/website

Install the dependencies

pip install -r requirements.txt

How does it work?

The tool will first check if directory listing is available. It 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:

  • Fetch all common files (.gitignore, .git/HEAD, .git/index, etc.);
  • Find as many refs as possible (such as refs/heads/master, refs/remotes/origin/HEAD, etc.) by analyzing .git/HEAD, .git/logs/HEAD, .git/config, .git/packed-refs and so on;
  • Find as many objects (sha1) as possible by analyzing .git/packed-refs, .git/index, .git/refs/* and .git/logs/*;
  • Fetch all objects recursively, analyzing each commits to find their parents;
  • Run git checkout . to recover the current working tree
You can’t perform that action at this time.