Automatically add LeetCode solutions to your GitHub

Having a nice GitHub commits graph means a lot to us developers. However, we do many things that are directly related to programming but we don't put them on our GitHub. Which is the case with solving LeetCode Problems, However a developer named Qasim created an extension to automate the process of putting your solutions on GitHub, and that extension is called LeetHub.

What is LeetHub?

It is a chrome extension that automatically pushes your code to GitHub when you pass all tests on a Leetcode problem. It creates a folder with the problem's name, and the commit message will be your rating so that it appears beautifully on your profile as you can see below.

image.png

and if the stats you have do not satisfy you, you can optimize your code and resubmit, and LeetHub will do its magic and update your repo.

But I will give access to my GitHub to an external service, my job won't allow it

You are giving no one access to your GitHub, in fact, the extension stores everything on local storage. In addition, due to this case, the app is now open source which makes it trustworthy.

How Does a problem's folder look like

LeetHub generates a Readme.md file that has the problem description as well as any associated images, it also puts your notes on a notes.md file and finally it uploads your solution. Here's a live example.

How To Install

Downloading

It is a simple chrome extension so you install it as you would do with any chrome extension.

  1. Go to the extension's page
  2. Click on add to chrome

    Setting Up

    Click on the icon on the chrome extension's section then click on authenticate

image.png

image.png

Then you will be prompted to this page

image.png

I already have a repository created so I'll pick the "Link to an existing Repository" option and enter the repo's name and then click on "Get Started"

image.png

If you're redirected to the page below then everything should be alright. image.png

Now just start solving problems on LeetCode and your submissions will be automatically added to your GitHub.

Happy Hacking