Publishing notebooks on GitHub

To support collaboration with stakeholders and the data science community at large, you can publish your notebooks in GitHub repositories. You can also use this integration feature as a method to backup notebooks for source code management purposes.

Watch this video to see how to enable GitHub integration.

Figure 1. Video iconPublish notebooks to GitHub
This video demonstrates how to publish notebooks to GitHub.

Enable access to GitHub from your account

Before you can publish notebooks on GitHub, you must enable your Watson Studio app to access GitHub. You enable access by creating a personal access token with the required access scope in GitHub and linking the token to your Watson Studio app.

Follow these steps to create a personal access token:

  1. Navigate to your Watson Studio account settings, and click the Integrations tab.
  2. Click the GitHub personal access tokens link on the dialog and generate a new token.
  3. On the New personal access token page, select repo scope and then click to generate a token.
  4. Copy the generated access token and paste it in the GitHub integration dialog window in Watson Studio.

After you have saved the access token, your project in Watson Studio must be connected to an existing GitHub repository. You can only link to one existing GitHub repository from a project in Watson Studio. Private repositories are supported.

To link a Watson Studio project to an existing GitHub repository, you must have administrator permission to the project. All project collaborators, who have adminstrator or editor permission, can publish files to this GitHub repository. However, these users must have permission to access the repository. Granting user permissions to repositories must be done in GitHub.

To connect a project to an existing GitHub repository:

  1. Go to the project’s Settings page.
  2. Enter the browser URL of the GitHub repository in the GitHub Respository section.

Now you can begin publishing notebooks on GitHub.

Publish a notebook on Github

To publish a notebook, you can:

  • Select the notebook in the Notebooks list on the project’s Overview page and click Actions>Publish on GitHub.
  • Click the upload icon (Shows the upload icon) and select Publish on GitHub from the opened notebook’s action bar. The notebook must be opened in edit mode.

When you enter the name of the file you want to publish on GitHub, you can specify a folder path in the GitHub repository.