Glsync
CLI tool to sync all previous LeetCode submissions to Github
Install / Use
/learn @ahmed-e-abdulaziz/GlsyncREADME
glsync
CLI tool to sync all your LeetCode submissions to Github (And possibly any other git client)
Requirements
- Git
- Empty repo on GitHub to push your submissions to
- Go 1.23.3 or later to build or install
- Make to use the Makefile
Introduction
This tool makes it easy to take all the code you previously submitted to LeetCode and submit it to Github or any other git client.
I created it because companies judge interviewees by how frequently they commit to Github. This can make time spent in LeetCode feel wasted, as it won't be visible on your GitHub profile.
Some tools do something similar but require submitting each question independently, which is useless if you want your previous commits. I found another tool that commits all your code but doesn't respect the submission timestamp. So, your GitHub profile will look weird with all your LeetCode submitted simultaneously. That also doesn't showcase your journey with LeetCode or how you improved the type of questions you are solving.
So now, with one single command, you can transfer all of your LeetCode submissions to GitHub, and each commit will use the LeetCode's submission timestamp
Leaderboard
A leadboard of the largest repos created by glsync, contact me or raise an issue to add your repo here as well or if the count is not up to date.
| Rank | Repo | Solutions Count | Language | | ----- | --------------------------------------------------------- | --------------- | -------- | | 1 🌟 | https://github.com/segorucu/Leetcode | 1058 | Python | | 2 | https://github.com/Fabiobreo/leetcode-fabiobrea | 265 | C# | | 3 | https://github.com/llEraserheadll/LeetcodeSol | 189 | Python | | 4 | https://github.com/ahmed-e-abdulaziz/leetcode-ahmedehab95 | 116 | Go, Java |
Installation
Do one of the following:
- Download the released binaries on the GitHub repo and use them directly after renaming it to
glsync - Clone the repo and run
make install, make sure that your $PATH contains your $GOPATH, such as the following snippet
export GOPATH=$HOME/go #Don't do if GOPATH is already set
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
LeetCode Cookie
You need LeetCode's session cookie to access the GraphQL endpoints and get the code submissions.
You can get the cookie by doing the following:
- Log in to https://leetcode.com. Log out first if you are already logged in as we need a fresh login
- Open developer tools or console. Here is how to do it in Chrome https://developer.chrome.com/docs/devtools/open
- Navigate to the Application tab
- Select Cookies in the left panel
- Copy the value for LEETCODE_SESSION
Usage
Run the following
glsync -lc-cookie="$YOUR_LEETCODE_COOKIE_GOES_HERE" -repo-url="$YOUR_GITHUB_REPO_URL_GOES_HERE"
It will keep printing each time it commits, showing the progress, and exiting when it finishes.
Demo

You can find the demo video in this repo at docs/glsync-full-demo.mp4
How it works
It does the following:
-
Fetch from LeetCode your submissions using their GraphQL endpoint using the following queries:
userProgressQuestionListto get the questions you answered with the timestamp.submissionListto get the submission ID and code language.submissionDetailsto get the last submission code.
-
Clone the target code's Git repo.
-
For each LeetCode submission, commit using its timestamp.
-
Push the commits to Git and delete the local cloned repo.
High-Level Diagram
High-level diagram to show how glsync components interact with each other

Sequence Diagram
Sequence Diagram showing how glsync works

Result

This is an example of me running glsync against my LeetCode account, you can see the commit dates aren't the same as it respects the dates I did the commits on and it has all the questions I solved on LeetCode. You can see this repo here
Notes
I did this in about a week, so if you want more features or to support other platforms, or if you encounter bugs, feel free to reach out to me at ahmed.ehab5010@gmail.com
Related Skills
node-connect
352.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
