Repl.it/GitHub Integration
Appearance
< Repl.it
Repl.it supports integration with GitHub public repositories using the graphic user interface and with public and private repositories using git commands. This resource shows how to integrate with GitHub using git commands.
Fetch an Existing GitHub Repository
[edit | edit source]To fetch an existing repository into the current folder:
- Log in to Repl.it. Create a user account if you don't have one already.
- Create a new repl if necessary.
- Review workspace shortcuts and open a new shell, such as with Ctrl+Shift+S.
- In the terminal window, run the following command:
git init
- In the terminal window, type the following command, but don't run it yet:
git remote add origin
- In a separate browser tab, log into GitHub and select a repository. Select
Clone or download
and copy the repository URL to the clipboard. - In the Repl.it tab terminal window, finish the
git remote add origin
command by pasting the repository URL at the end and run the command. The command should look like the following:git remote add origin your_repository_url
- In the terminal window, run the following commands. The repository will be merged with the current folder.
git fetch --all
git reset --hard origin/master
Update the Run Button
[edit | edit source]The run
button action is controlled by the .replit
file:
- If necessary, create a
.replit
file in the root folder of your repository. - The .replit file should contain the following lines (Python3 example):
language = "python3"
run = "python3 main.py"
- To run a different file, change the .replit file run line. For example, to run a file named
Activity 1.py
in theAssignment 1
folder, use the following. Note the nesting of single quotes inside double quotes, necessary with folder or file names containing spaces:run = "python3 'Assignment 1/Activity 1.py'"
Synchronize Changes with GitHub
[edit | edit source]To synchronize Repl.it changes with GitHub, use the following git commands in the terminal window:
git add . git commit -m "some commit message" git push
When your repository is updated outside Repl.it and you want to pull those changes into your repl, use the following command:
git pull
See Also
[edit | edit source]- Repl.it: Repl.it + Git Tutorial
- Repl.it: Using Git with Repl.it - A Short Guide
- Repl.it: A Comprehensive Guide to Replit's New Git and GitHub Features
- Repl.it: Configuring GitHub Repos to Run on Repl.it and Contributing Back