Skip to main content

A tool to dump a git repository from a website

Project description

git-dumper

A tool to dump a git repository from a website.

Install

This can be installed easily with pip:

pip install git-dumper

Usage

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`
  --client-cert-p12 CLIENT_CERT_P12
                        client certificate in PKCS#12 format
  --client-cert-p12-password CLIENT_CERT_P12_PASSWORD
                        password for the client certificate

Example

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

Disclaimer

Use 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.

Build from source

Simply install the dependencies with pip:

pip install -r requirements.txt

Then, simply use:

./git_dumper.py http://website.com/.git ~/website

How does it work?

The 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:

  • 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_dumper-1.0.8.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_dumper-1.0.8-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file git_dumper-1.0.8.tar.gz.

File metadata

  • Download URL: git_dumper-1.0.8.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for git_dumper-1.0.8.tar.gz
Algorithm Hash digest
SHA256 31510d4ed965729697d9b6f1bb1e9ad502b9b026c2e48b788efa84ce6dab868a
MD5 6c71e48ab780d0d27be23d3ef8510c0a
BLAKE2b-256 2402ebad601361797096ebb074e27bcdddddcef84be43aca321c4c2055d78c7d

See more details on using hashes here.

File details

Details for the file git_dumper-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: git_dumper-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for git_dumper-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 83aab0dfa054ff18a858fdeb24f1a8c0d9648f0ab5e1acbeb1493cf5e4438bce
MD5 58484400a503e6edce086259bd28dbe3
BLAKE2b-256 634f7d9aad6ea0f6be1037b31c1d2792fe1c75e564af52b0851c2c1166d899f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page