Web deployment misconfigurations frequently leave internal version control directories exposed to the public internet. When developers deploy web applications by cloning repositories directly into the web root without properly restricting web server access, the entire .git directory becomes accessible. This flaw exposes the complete source code, commit history, and potentially sensitive credentials or API keys. Git-Dumper is an automated command-line tool specifically designed to extract and reconstruct these exposed Git repositories from target websites. Security researchers often discover these exposed directories during the initial web reconnaissance phase, utilizing directory brute-forcing techniques and interception proxies as outlined in our comprehensive Burp Suite tutorial, before deploying Git-Dumper to pull the source code for offline static analysis.
Maintained on the official Git-Dumper GitHub repository, the tool provides an intelligent extraction mechanism that standard web scrapers lack. A simple recursive download using utilities like wget or curl usually fails to retrieve a functional Git repository because conventional scrapers cannot navigate unlinked object files or decipher Git’s internal storage structure.
Git-Dumper solves this problem through intelligent parsing. It initiates the extraction by downloading fundamental repository configuration files, including .git/config, .git/HEAD, .git/logs/HEAD, and .git/index. It then parses these core files locally to identify the required commit objects, tree objects, and binary large objects (blobs). By systematically requesting each missing hash directly from the server, the tool rebuilds the repository structure exactly as it exists on the remote host.
Git-Dumper is developed in Python and requires minimal system dependencies. The most reliable way to install the tool across Linux, macOS, and Windows environments is through the Python Package Installer (pip). Open your terminal and execute the following command:
pip install git-dumper
Ensure that your Python environment paths are correctly configured so that the git-dumper executable is available globally from your command line.
The tool offers several configurable parameters to optimize the extraction process, manage network timeouts, and bypass basic web application firewall (WAF) filtering.
The basic command syntax requires only the target URL pointing to the exposed directory and a local destination directory:
git-dumper [options] URL DIR
--proxy PROXY: Routes all extraction requests through a specified proxy server. This is highly useful when pivoting through internal networks or intercepting traffic for debugging.-j JOBS, --jobs JOBS: Defines the number of simultaneous HTTP requests. Increasing this speeds up the download process significantly but creates more noise in the target server’s access logs.-r RETRY, --retry RETRY: Specifies the maximum number of request attempts for a specific file before giving up.-t TIMEOUT, --timeout TIMEOUT: Sets the maximum time in seconds the tool will wait for a server response.-u USER_AGENT, --user-agent USER_AGENT: Spoofs the HTTP user-agent string to mimic standard web browsers, helping avoid automated blocking mechanisms.-H HEADER, --header HEADER: Injects additional HTTP headers into the requests, which is necessary for bypassing authentication gateways or providing session cookies.Once you verify that a target website exposes its version control system, you can initiate the extraction process. The following example demonstrates how to dump the repository from example.com and save it to a local folder named website_repo.
git-dumper http://example.com/.git ~/website_repo
After the download completes successfully, navigate into the output directory and use standard Git commands to explore the compromised source code. Running commands like git status, git log to view historical commits, or git checkout to restore deleted files provides invaluable insight during a penetration test or source code audit.