Learn to Code via Tutorials on Repl.it!

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

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:

https://repl.it/badge/github/plibither8/2048.cpp

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!

Voters
programmeruser
RayhanADev
NEED1
KarthikRamachan
ceilingrat
wjnb
CodingGoose
CoolJames1610
calebGarrick
HomewardBound
Comments
hotnewtop
Grify

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

lucasverra

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

amasad
rediar
Zavexeon

73 notifications... lol.

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

[deleted]
Elizabeth11
Elizabeth11
Elizabeth11
Mechakleopteryx

Before running the build command, "cd build ...etc", I had to run the command "mkdir build".

[deleted]

how export?

ceilingrat

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

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

artystable

Great thanks!

LaylaAli1
Scoder12
Scoder12
Kognise
Scoder12

@Kognise I seem to recall a "You can't send pull requests to yourself" rule...

qualladoom

most funnily because he lists my water.css request as his lol
@Scoder12

Kognise

@enigma_dev Yours didn't even work, mostly because your .replit file was broken

qualladoom

uhoh @Kognise

piemadd
piemadd
piemadd
piemadd
piemadd
HarshdeepKahlo1

Discord Username: ozaiworld#6551

dialogarithm
AllAwesome497

@dialogarithm pay attention before you make the pull requests, you made a second one 13 hrs after I did and mine was never closed. https://github.com/unknownblueguy6/MineSweeper/pull/5
https://github.com/unknownblueguy6/MineSweeper/pull/6

AdCharity

: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

@AdCharity wdym "notifications on the images"?

qualladoom

in the upper left [email protected]

AdCharity

@amasad the little bell thing in the upper left corner

MrEconomical
joshwood
joshwood
joshwood
joshwood
joshwood
joshwood

This one's got 5k+ stars:
https://github.com/chubin/wttr.in/pull/381
(I think this one's likely to merge, just it isn't merged yet.)

joshwood
joshwood
AllAwesome497
mmbnforlife
slip1244
slip1244
vityavv
vityavv
vityavv

@vityavv https://github.com/FlyingKatsu-Discord-Bots/Discord-GitLab-Webhook/pull/16

BTW, this one and a few others will still error because no token has been provided, but they do work

vityavv
vityavv
vityavv

@vityavv https://github.com/DiscordBotList/Luca/pull/42 this one you have to add the token to the end

LeVi0826
LeVi0826
LeVi0826
LeVi0826

this one is a little late because of bugs https://github.com/go101/go101/pull/141

shiv213
artemis21
artemis21
artemis21
Mooopy
Mooopy
Mooopy
VexeDev
VexeDev
VexeDev
VexeDev
VexeDev
VexeDev
VexeDev
qualladoom
qualladoom
qualladoom
qualladoom
qualladoom
qualladoom
qualladoom
qualladoom
qualladoom
qualladoom