Automatically sync your accepted LeetCode submissions to GitHub.
Solve problems on LeetCode, and CommitCode saves and pushes your solutions automatically — no manual uploads needed.
- Fetches accepted LeetCode submissions automatically
- Pushes solutions directly to GitHub
- Runs every 10 minutes in the background
- Prevents manual copy-paste workflow
- Organizes solutions neatly by platform
- Lightweight and easy to configure
CommitCode periodically checks your LeetCode account for newly accepted submissions using the LeetCode GraphQL API.
When a new solution is detected:
- The solution code is fetched
- A file is generated automatically
- Git commits and pushes the update to your repository
git clone https://github.com/your-username/commitcode.git
cd commitcodepip install requestsCreate a config.json file:
{
"leetcode": {
"username": "your_username",
"session_cookie": "your_LEETCODE_SESSION_cookie"
}
}echo "config.json" >> .gitignore
echo "logs/" >> .gitignore
echo "__pycache__/" >> .gitignore- Log into LeetCode
- Open Developer Tools (
F12) - Go to:
- Application → Cookies →
leetcode.com
- Application → Cookies →
- Copy the value of:
LEETCODE_SESSION
python main.pypython main.py --no-pushYou can use Windows Task Scheduler to run CommitCode every 10 minutes.
Program
C:\path\to\venv\Scripts\python.exe
Arguments
main.py
Start In
C:\path\to\commitcode
- Python
- Git
- LeetCode GraphQL API
- Windows Task Scheduler
- requests
- subprocess
- argparse
- logging
- json
- os
commitcode/
├── main.py
├── leetcode_fetcher.py
├── git_committer.py
├── config.json
└── solutions/
└── leetcode/
- GitHub Actions support
- Multi-platform coding support
- Docker support
- Daily statistics dashboard
- Auto README progress updates
This project is open-source and available under the MIT License.