A Python tool that scans GitHub commit history to find email addresses associated with a GitHub username.
- Extracts email addresses from commit history of a GitHub user
- Shows the repositories where the emails were found
- Lists direct links to commits made with a specific email
- Python 3.7 or higher
- Clone and enter the repository:
git clone https://github.com/ternera/github-email-finder.git cd github-email-finder - Install the required dependencies:
pip3 install -r requirements.txt
Basic usage:
python3 script.py USERNAMEWith options:
python3 script.py USERNAME --token YOUR_GITHUB_TOKEN --contributionsYou can set your GitHub token as an environment variable to avoid passing it on the command line:
# For bash/zsh
export GITHUB_TOKEN=your_github_token
# For Windows CMD
set GITHUB_TOKEN=your_github_token
# For Windows PowerShell
$env:GITHUB_TOKEN = "your_github_token"Then run the script without the token parameter:
python3 script.py USERNAMEUSERNAME: The GitHub username to search for (required)--token,-t: GitHub personal access token (optional but recommended - you will hit ratelimits quickly otherwise)--email,-e: Instead of listing emails, list direct links to the commits made with this specific email--contributions,-c: Include repositories the user has contributed to--verbose,-v: Enable verbose output with additional details
python3 script.py terneraInclude repositories the user has contributed to:
python3 script.py ternera --contributionsUse with a GitHub token for higher rate limits:
python3 script.py ternera --token ghp_xxxxxxxxxxxxList links to every commit a user made with a specific email:
python3 script.py ternera -e example@gmail.comOutput:
https://github.com/ternera/repo1/commit/<sha>
https://github.com/ternera/repo2/commit/<sha>
...
While the tool works without a token, GitHub API has rate limits that will quickly restrict your usage. To get a GitHub personal access token:
- Go to GitHub Settings > Developer settings > Personal access tokens
- Click "Generate new token"
- Give it a name and select the "public_repo" scope
- Click "Generate token" and copy the token
- This script fetches the user's repositories using the GitHub API
- It can search in the repositories the user has contributed to, using the
--contributionsflag. - For each repository, it scans the commit history to find commits by the user
- It extracts email addresses from the commit author and committer data
- It filters out GitHub's no-reply email addresses
- It presents the results in a formatted table
- Private repositories are only accessible if your user token has permissions to view them
- The tool only finds emails used in commits, not emails in the user's profile
- The search for contributed repositories is limited to 100 repositories
This tool is for educational purposes only. Please respect GitHub's terms of service and privacy policies when using this tool.