|
| 1 | +# How to Use the GitHub Contribution Bot |
| 2 | + |
| 3 | +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. |
| 4 | + |
| 5 | +**Disclaimer:** This script modifies your repository's commit history significantly. Use it with caution and preferably on a dedicated repository. |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +1. **Git:** Ensure Git is installed on your system. ([Download Git](https://git-scm.com/downloads)) |
| 10 | +2. **Node.js:** Ensure Node.js (which includes npm) is installed. ([Download Node.js](https://nodejs.org/)) |
| 11 | +3. **GitHub Account:** You need a GitHub account. |
| 12 | +4. **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. |
| 13 | +5. **GitHub Personal Access Token (PAT):** It's recommended to create a PAT with the `repo` scope (for full control of private repositories) to authenticate Git operations securely, especially for pushing. ([Create a PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic)) |
| 14 | + |
| 15 | +## Steps |
| 16 | + |
| 17 | +1. **Clone the Repository:** |
| 18 | + Open your terminal or command prompt and clone the repository: |
| 19 | + ```bash |
| 20 | + git clone https://github.com/Dynamo14324/github-bot.git |
| 21 | + cd github-bot |
| 22 | + ``` |
| 23 | + |
| 24 | +2. **Install Dependencies:** |
| 25 | + Install the necessary Node.js packages: |
| 26 | + ```bash |
| 27 | + npm install |
| 28 | + ``` |
| 29 | + |
| 30 | +3. **Configure Your Email:** |
| 31 | + * Open the `index.js` file in a text editor. |
| 32 | + * Find the line that configures the Git user email (around line 16): |
| 33 | + ```javascript |
| 34 | + await git.raw(["config", "user.email", "'[email protected]'"]); |
| 35 | + ``` |
| 36 | + * **IMPORTANT: ** Replace `'[email protected]'` with **your own verified GitHub email address **, keeping the single quotes around it. |
| 37 | + * You can also update the `user.name` on the line above if desired. |
| 38 | + |
| 39 | +4. **Configure Authentication (Recommended: PAT):** |
| 40 | + * The script currently includes a token directly in the push URL (line 58). **This is not secure.** |
| 41 | + * **Recommended:** Remove the token from the URL in `index.js`: |
| 42 | + ```javascript |
| 43 | + // Change this: |
| 44 | + const remote = `https:// [email protected]/Dynamo14324/github-bot.git `; |
| 45 | + // To this (replace USERNAME with your GitHub username): |
| 46 | + const remote = `https://github.com/USERNAME/github-bot.git`; |
| 47 | + ``` |
| 48 | + * 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. |
| 49 | + |
| 50 | +5. **Run the Script:** |
| 51 | + Execute the script from the `github-bot` directory: |
| 52 | + ```bash |
| 53 | + node index.js |
| 54 | + ``` |
| 55 | + * The script will start generating ~365 commits with random dates from the past year. |
| 56 | + * It will configure the local Git user, make commits locally, and then attempt to push them all to the `main` branch of the repository specified in the script (currently `Dynamo14324/github-bot`). |
| 57 | + * **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.js` script (line 58 or as modified in step 4) and potentially the repository path (`repoPath` variable on line 8). |
| 58 | +
|
| 59 | +6. **Verify:** |
| 60 | + * Wait for the script to finish (it will print "All commits pushed successfully."). |
| 61 | + * Check your GitHub profile page. It might take a few minutes for the contribution graph to update. |
| 62 | +
|
| 63 | +By following these steps and ensuring you use your verified email, the generated commits should appear on your contribution graph. |
0 commit comments