This guide explains how to use the script in the Dynamo14324/github-bot repository to populate your own GitHub contribution graph with past-dated commits.
Disclaimer: This script modifies your repository's commit history significantly. Use it with caution and preferably on a dedicated repository.
- Git: Ensure Git is installed on your system. (Download Git)
- Node.js: Ensure Node.js (which includes npm) is installed. (Download Node.js)
- GitHub Account: You need a GitHub account.
- Verified Email: You must know an email address that is registered and verified with your GitHub account. Contributions are only counted if the commit email matches a verified email on your account.
- GitHub Personal Access Token (PAT): It's recommended to create a PAT with the
reposcope (for full control of private repositories) to authenticate Git operations securely, especially for pushing. (Create a PAT)
-
Clone the Repository: Open your terminal or command prompt and clone the repository:
git clone https://github.com/Dynamo14324/github-bot.git cd github-bot -
Install Dependencies: Install the necessary Node.js packages:
npm install
-
Configure Your Email:
- Open the
index.jsfile in a text editor. - Find the line that configures the Git user email (around line 16):
await git.raw(["config", "user.email", "'yogeshjadhavfyjc@gmail.com'"]);
- IMPORTANT: Replace
'yogeshjadhavfyjc@gmail.com'with your own verified GitHub email address, keeping the single quotes around it. - You can also update the
user.nameon the line above if desired.
- Open the
-
Configure Authentication (Recommended: PAT):
- The script currently includes a token directly in the push URL (line 58). This is not secure.
- Recommended: Remove the token from the URL in
index.js:// Change this: const remote = `https://<YOUR_GITHUB_PAT>@github.com/USERNAME/github-bot.git`; // To this (replace USERNAME with your GitHub username): const remote = `https://github.com/USERNAME/github-bot.git`;
- Then, configure Git to use your PAT for authentication when pushing. You can do this globally or use credential helpers. Alternatively, when Git prompts for username/password during the push, use your GitHub username and your PAT as the password.
-
Run the Script: Execute the script from the
github-botdirectory:node index.js
- The script will start generating ~365 commits with random dates from the past year.
- It will configure the local Git user, make commits locally, and then attempt to push them all to the
mainbranch of the repository specified in the script (currentlyDynamo14324/github-bot). - Note: If you want to push to your own fork or a different repository, you'll need to update the remote URL in the
index.jsscript (line 58 or as modified in step 4) and potentially the repository path (repoPathvariable on line 8).
-
Verify:
- Wait for the script to finish (it will print "All commits pushed successfully.").
- Check your GitHub profile page. It might take a few minutes for the contribution graph to update.
By following these steps and ensuring you use your verified email, the generated commits should appear on your contribution graph.