Clone via Git...

Securely clone your pipeline’s Git repository so you can work locally or in another Git-enabled environment.

Git clone your Capsule to your computer

  1. Click the Capsule menu and select Clone via Git.

  2. This will provide you with the appropriate Git repository URL.

  1. Copy and paste the URL and via a terminal or Git client, run git clone [url] .

  2. This will prompt you for your username and password. The username is your email used to log in to Code Ocean, and the password is the text generated by clicking "Generate New Access Token" button in the above screenshot

  3. From that point, you can push, pull, etc. to the corresponding Code Ocean Capsule.

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

This section 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 the Capsule menu and select Clone via Git:

  1. A message to appear with your Capsule's git information:

  1. Click the clipboard icon in Step 2 to copy the Github clone 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. 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:

  1. 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.