Skip to content
← Back to Community
🎁 Using Git with Repl.it: A Short Guide
Profile icon
hyperupcall

🎁 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.chdir('./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!)

This file cannot be displayed: https://storage.googleapis.com/replit/images/1555799479365_3012213c48d096ade2cc9a6df8d2b65f.pn

Now, you can just clone it the usual way.

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

This file cannot be displayed: https://storage.googleapis.com/replit/images/1555799638232_3678f7f131d11b2360c2ec6f985b64c5.pn

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.

This file cannot be displayed: https://storage.googleapis.com/replit/images/1555798032505_53c3d59b4d5fd13df72a14aa25640bc5.pn

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

Voters
Profile icon
ultrasoncihazi
Profile icon
arielcavalcante
Profile icon
programmeruser
Profile icon
hayaodeh
Profile icon
cat_optimist
Profile icon
Rykaqj
Profile icon
katyadee
Profile icon
coalesce
Profile icon
a5rocks
Profile icon
SigmaPhi
Comments
hotnewtop
Profile icon
ArchieMaclean

You can also press Ctrl Shift P (and type shell) to open the shell, if you don't have the function keys (like me).

Profile icon
hyperupcall

@ArchieMaclean Hey, thanks for the tip! I put that in there. I'll edit it in - hopefully it helps out some fine chaps! :)

Profile icon
Vandesm14

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.

Profile icon
[deleted]

Do you guys maybe know the keys on a chromebook?
I tried Ctrl+Shift+P but it is not working.
I have no FN Key.
I tried to get this to work with my python project.

Profile icon
hyperupcall

Hmm. Does it work when you only press "F1"?

Profile icon
SCOTBUTZBACH

here's how to use function keys on a chromebook. press and hold the search key, and use the top row keys, excluding escape and the power key. you only get 10 functions keys to use if you do this.

Profile icon
SCOTBUTZBACH

or get a keyboard with all 12 function keys, plug it in to your chromebook, and use the same method, except you use the key that brings up the start menu, if you were using a normal pc.