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`

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.5.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

git_dumper-1.0.5-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file git-dumper-1.0.5.tar.gz.

File metadata

  • Download URL: git-dumper-1.0.5.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for git-dumper-1.0.5.tar.gz
Algorithm Hash digest
SHA256 802c4fd3abc033bb281344c681f30d39d9b18ba776a00a0b8b16b2f092da2038
MD5 19c1d50d1f44cf92013971f3418c2ea8
BLAKE2b-256 52b5efc0fb6b4efb02e6aa36006b91e6142a0b4bc7eec18ad46432786a631e20

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_dumper-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for git_dumper-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 54f19cc435a91ec743a34711f4cbcb758cf5c6d31e5bc20b30d13e0e5da79e44
MD5 ac22b6ae64926fff19940b7d66c842ae
BLAKE2b-256 d75000e2401c095dd9eb6df6fefebee4e180e7a356e8894e86f626a203042ada

See more details on using hashes here.

Supported by

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