Learn to Code via Tutorials on Repl.it!

← Back to all posts
Configuring GitHub repos to run on Repl.it and contributing back
amasad (3456)

You might have noticed that it's now possible to import your GitHub repos into repls. If you haven't yet, consider connecting your GitHub account to repl.it to make it easier to import and contribute back.

In this guide I'm going to show you how to configuring a repo to run on repl.it and how you can contribute back a neat "run on repl.it" button to the repo. It looks like this:


I'm going to use this repo (https://github.com/plibither8/2048.cpp) as an example. (It's an implementation of 2048 in C++ that works in the terminal!)

First let's import the repo to repl.it. Click "import repo" from the header.

Then add in the repo url:

Click "create from GitHub" and after the repo clones you'll see a configuration pane to figure out the language and how to run the repo.

Now, you have to try to figure out the run command from the repo. Typically, you'd want to read the instructions in the readme or play with it in the shell to figure out how to best run it. In this case I figured out that:

  1. The language is cpp (from the name duh)
  2. From the readme I figured out that the run command should be cd build && cmake ../ && cmake --build . && ./2048

Click "done" and then you'll see two things:

  1. A .replit file: This is where the configuration gets saved
  2. The config pane gets replaced with instructions on how to contribute the run badge and configuration back to the repo

Before we get to contribute back let's make sure it actually runs:

Sweet! Now follow the steps in the pull request pane which should give you code to paste in the readme:

Preview the readme and make sure the "run on repl.it" button renders correctly:

Now simply click on "prepare pull request" which will take you to GitHub where you can fill in the rest of the details. For this repo, I already sent a pull request. Check it out: https://github.com/plibither8/2048.cpp/pull/117

I'm excited to see more Repl.it badges all over GitHub so that all repos can be easily run. Please help people get their repos work on Repl.it and in the process contribute to open source!

Grify (169)

Any planned support for other git platforms like BitBucket? (the one I use) or GitLab? (the one my dad uses)

lucasverra (1)

this is a game changer. The PR maker is awesome for viral effect :)

Zavexeon (1164)

73 notifications... lol.

Has this update been causing instability on repl.it? I've gotten the heroku error page twice.


how export?

ceilingrat (3)

Hi @amasad !

Do you have any information about how the 'Run on Repl.it' button will be affected by the sunsetting of anonymous repls? ( https://blog.repl.it/anon )

I'm preparing to give a lightning talk about Repl.it, focused on the 'Run on Repl.it' button and I'd like to anticipate what changes are in store.

Many thanks!

ceilingrat (3)

I see now that the changes are already rolled out, so I can answer my own questions. Sorry, don't mind me!

AdCharity (1321)

:D I like this new github feature (really makes it easy 4 a lot of projects). Honestly tho the only thing I really saw were the 70 notifications on the images lmao

amasad (3456)

@AdCharity wdym "notifications on the images"?

AdCharity (1321)

@amasad the little bell thing in the upper left corner