Adding a Code Ocean capsule as a remote to an existing git repository

For integrating Code Ocean into your local development process.

This article assumes that you have a git repo on your computer and that you are reasonably comfortable with Git commands. If you are just getting started with git, you can follow along by forking and then cloning a public GitHub repo.

  1. Click Copy to copy the URL.

  2. Navigate to your local git repo on your computer, run git init if you have not already, and add the copied link as a remote (in the below example, the remote is called co): git remote add co https://git.codeocean.com/capsule-<id>.git

  3. You can check this worked by running git remove -v

  4. Next, you will push your local files to Code Ocean by a command like git push co master (in this example, the repo is on the master branch but yours might not be).

  5. If this is your first time running git push from your computer, you will be prompted for your username and password. Use your username and password for Code Ocean.

  6. Your capsule will then show that changes are being pushed:

  7. You can now push, pull, etc. between your local repo and Code Ocean, and the capsule will have your full git history displayed on its timeline.

Once you've set up the capsule as a remote, you no longer need to have the capsule open, nor to be logged in, to push your code.

Last updated