🎁 Using Git with Repl.it: A Short Guide
eankeen (2047)

🎁 Using Git with Repl.it: A Short Guide

I stumbled upon this post, which described a method to access Git commands from within your repl. Using a Version Control System (VCS) like Git is incredibly useful, and even more so when augmented with GitHub.

In the post, the accepted answer recommended using the os Python module and accessing system commands from there.

import os
os.system('git clone https://github.com/EanKeen/Sigag')
os.system('git status')

I created a little repl that demonstrates this. Make sure you delete the Sigag directory before starting the program (although it's not a strict requirement). After the clone has finished, I'm able to leave the repl, reopen the repl, and have the Git repository still there.

However, there is a much easier way to use Git commands. In most repls, you're able to enter the shell. Press F1, and type shell. Note that with some keyboards, you may need to press Fn+F1. (You can also press Ctrl+Shift+p - thanks @ArchieMaclean!)


Now, you can just clone it the usual way.

git clone https://github.com/EanKeen/Sigag
cd ./Sigag
git status


Once the clone has finished, you should see the Sigag directory in your file tree!

However, the output of ls and your file tree may be different sometimes. For example, I would type ls into the shell, and it will show Sigag as a directory. However, my file tree would only show main.py. To fix this, simply refresh the page.

It may seem a bit convoluted getting this to work, but easier methods of using git will be introduced at a later date, according to the post below. The screenshot below was taken on the publish date of this guide.


I hope this was helpful 😄. Let me know if this helped you!

You are viewing a single comment. View All
Vandesm14 (2644)

The problem is after cloning a repo, it will be cloned into a separate folder. This prevents me from running the index.js file inside of that repo folder, since repl.it looks for the index.js located in /home/runner and not in /home/runner/repo. Another problem is file updates. After cloning a repo and refreshing the page (to update the file GUI) the repo folder is deleted and the file tree is replaced with the original repl files. Repl.it, please fix this so It will work.