This repository automatically syncs your accepted LeetCode submissions to GitHub, organizing them by problem ID and including problem descriptions.
-
Install dependencies:
pip install -r requirements.txt
-
Edit the setup file for your OS:
- Linux/macOS:
setup.sh - Windows:
setup.bat
- Linux/macOS:
-
Fill in your credentials:
setup.sh:# LeetCode export LEETCODE_SESSION="your_session_cookie" export CSRFTOKEN="your_csrf_token" # GitHub export GIT_PAT="your_github_personal_access_token" export REPO_URL="https://github.com/yourusername/yourrepo.git"
setup.bat:@echo off REM LeetCode set "LEETCODE_SESSION=your_session_cookie" set "CSRFTOKEN=your_csrf_token" REM GitHub set "GIT_PAT=your_github_personal_access_token" set "REPO_URL=https://github.com/yourusername/yourrepo.git"
-
Run it!
Linux/macOS:chmod +x setup.sh && ./setup.shWindows:
setup.bat
That's it! Your LeetCode solutions will appear in the repo organized by problem.
β
All accepted submissions
β
Preserved runtime/memory stats
β
Problem descriptions in READMEs
β
Supports 25+ programming languages
βββ 0001-two-sum/
β βββ two-sum-1234567890.py
β βββ README.md
βββ 0002-add-two-numbers/
β βββ add-two-numbers-1234567891.java
β βββ README.md
βββ ...
-
Get LeetCode cookies:
- Log in to LeetCode
- Open DevTools (F12) β Application β Cookies
- Copy
LEETCODE_SESSIONandcsrftokenvalues
-
Create GitHub PAT:
- Settings β Developer settings β Personal Access Tokens
- Select
repopermissions
-
Proxy issues?
Set these in the setup file if needed:setup.sh:export HTTP_PROXY="your_proxy" export HTTPS_PROXY="your_proxy"
setup.bat:set "HTTP_PROXY=your_proxy" set "HTTPS_PROXY=your_proxy"
π‘ Pro Tip: Run this weekly to keep your solutions backed up!