Using the Open in Code Editor Button

Learn how to use the Open in Code Editor button.

Some Git repositories or websites feature an Open in Code Editor button. Clicking this button will automatically clone a repository in a Cloud Shell session and open it in Code Editor.

To use the Open in Code Editor button:
  1. Click the Open in Code Editor button.
  2. If prompted, log in to the OCI Console.
  3. A Code Editor session starts, and a Verify Cloning dialog appears, allowing you to verify that you want to clone the repository:

    One Click Clone Verify dialog box
    1. The destination directory defaults to the repository name. You can change this by entering a new value in the Enter directory name text box.
    2. Select the checkbox indicating that you have reviewed and accept the Oracle Terms of Use.
    3. Click the Clone button.

Code Editor will clone the repository into the destination directory and open the project's README file in the editor.

For example:One Click Clone README screenshot

Embedding an Open in Code Editor Button

You can add an Open in Code Editor button to your own README files.
Note

The recommended location for this link is the root README.md file of your Git repository.

To add an Open in Code Editor button in your own content, you need to specify the following parameters in your URL:

Parameters
URL Parameter Description
cs_repo_url [Mandatory] Any accessible Git Repo URL.
cs_branch [Optional] Branch to checkout. If not specified, the default branch is used.
cs_open_ce [Optional] Open Code Editor after cloning and executing any required scripts. Code Editor automatically opens the cloned folder in the workspace.
cs_initscript_path [Optional] Path to an executable script. The file path is relative to the current directory.
cs_readme_path [Optional] Path to a readme file in a git repo. The contents of this file will display in Cloud Shell or Code Editor after cloning the repo. This could contain a welcome message and further instructions to the user. The file path is relative to the current directory.
This example shows a URL to embed an Open In Code Editor button in a Git repository README.md file. With the click of the button, you will be redirected to the Oracle Cloud domain and all the required query parameters will be passed, as shown below:
[![Open in Code Editor](https://raw.githubusercontent.com/oracle-devrel/oci-code-editor-samples/main/images/open-in-code-editor.png)](https://cloud.oracle.com/?region=home&cs_repo_url=https://path-to-repo/sample.git&cs_branch=branch-name/to/checkout&cs_readme_path=relative-path/to/readme-file&cs_initscript_path=relative-path/to/script&cs_open_ce=true/false)
Note

We recommend the use of HTTP URLs rather than SSH URLs. For security, automatic script execution from non-trusted GitHub repositories is disabled, even when the redirected URL query parameters have a cs_initscript_path.