All Collections
Version Control
Moving repositories in and out of Code Ocean
Syncing your capsule with an outside git repository
Syncing your capsule with an outside git repository

You can clone, pull, or push changes from/to GitHub and other Git hosts using Cloud Workstation

Updated over a week ago

While you can create a capsule by importing an existing git repository from GitHub, GitLab, or other git hosts, a natural next step is to synchronize changes – either pushing changes you've made on Code Ocean to GitHub (for the sake of example), or pulling changes from GitHub to Code Ocean.

Although capsules don't do this automatically, the underlying git infrastructure makes it possible to do both things by running a few git commands.

First, you'll want to start a Cloud Workstation terminal session if you aren't already at the terminal (JupyterLab and R Studio both offer built-in terminals).

Second, make sure you have your repository URL (for example, and run the following commands:

  1. git remote add <remote-name> <repo-url>, e.g. git remote add github This is a configuration step you'll need to run every time you start Cloud Workstation since it doesn't persist across sessions (the remote name is arbitrary – anything will work.)

  2. If you're pulling new changes into Code Ocean, git pull <remote-name> master, e.g.  git pull github master. If you're pushing changes from Code Ocean, change pull  to push. (Note that this command may result in conflicts if you've made changes to both Code Ocean and your repository.)

Did this answer your question?