Repl.it/Bitbucket Integration
< Repl.it
Repl.it supports integration with Bitbucket using git commands.
Clone an Existing Bitbucket Repository
editTo clone a repository into Repl.it as a subfolder:
- Log in to Repl.it. Create a user account if you don't have one already.
- Create a new repl if necessary.
- Create a
.replit
file in the root folder of your repl. This changes the console window into a full Linux terminal. Another approach is to review workspace shortcuts and open a new shell, such as with Ctrl+Shift+S. - In a separate browser tab, log into Bitbucket and select a repository. Select the
Clone
button in the upper right corner. Copy thegit clone
command to the clipboard. - In the Repl.it tab, paste the git clone command into the terminal window and run the command. The repository will be created as a repl subfolder.
Fetch an Existing Bitbucket Repository
editTo 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 a separate browser tab, log into Bitbucket and select a repository. Select the
Clone
button in the upper right corner. Copy thegit clone
command to the clipboard. - In the Repl.it tab, paste the git clone command into the terminal window. Replace
git clone
withgit remote add origin
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
editThe 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 inmy repository
, use the following. Note the nesting of single quotes inside double quotes, necessary with folder or file names containing spaces:run = "python3 'my repository/Assignment 1/Activity 1.py'"
Synchronize Changes with Bitbucket
editTo synchronize Repl.it changes with Bitbucket, 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