Tutorial
Integrate a Git repo with your analytics project in IBM Cloud Pak for Data
Add collaborators, navigate the UI, and create a notebookLearning objectives
This tutorial shows you how to get started integrating a GitHub repository with your analytics project in IBM Cloud Pak for Data. You'll learn about the UI, set up a personal access token to collaborate on a project, and step through a hands-on scenario to learn how to push and pull changes to and from a connected repository.
Prerequisites
To follow along with this tutorial, you need the following:
- IBM Cloud Pak for Data
- Account to access a GitHub repository
Estimated Time
About 15 minutes
Steps
Step 1. Create a project integrated with Git
After logging into your instance of IBM Cloud Pak for Data, click on the hamburger menu on the top left and click on All projects. This will take you to the project page, allowing you to create a new project.

Create a new analytics project.

Create a project integrated with a Git repository.

Click on New Token and a Git integration pop-up window is displayed. Select one of the project repository options from the first drop-down (GitHub, BitBucket, Azure Repos, GitLab) and create a personal access token for the project repository from the embedded link, as described in the next step.

The embedded link will take you directly to your GitHub developer settings' personal access tokens, but in case you want to go there yourself, log into GitHub and go to Settings.

Select Developer settings from the left-hand menu. On the next page, select Personal access tokens from the left-hand menu. Click the Generate new token button in the top-right area of the page.
In the New personal access token UI, select the repo checkmark, which should auto-select other indented repo options as well, and click the Generate token button at bottom of the page.

Copy the generated GitHub token. Now go back to the browser tab for IBM Cloud Pak For Data and paste the token in the Access token field in the Git integration pop-up. Give the token a name (so you can manage it later in your IBM Cloud Pak For Data Profile > Settings > Integrations info) and click Continue.
Create a Git repository and copy over the URL ending in .git and select the branch you want to collaborate on. Finally, give your IBM Cloud Pak For Data project a name and click Create.

Step 2. Collaborating on the project
If you are a collaborator in a project that supports Git integration, you must create your own personal access token to the Git repository associated with the project to use this integration feature to share assets across the project
Click on your avatar on the top right of your IBM Cloud Pak For Data home page and go to Profile > Settings, then navigate to the Git Integrations tab.

Follow steps 4-6 from Create a project integrated with Git above to create a personal access token. Give it a name and continue.

Step 3. Navigating Git-integrated JupyterLab
In the upper right, next to Add to project, click Launch IDE and select JupyterLab from the drop-down.

Select the JupyterLab environment associated with Python 3 and launch.

Once the environment has been instantiated, you should be greeted by the launcher, where you can start a new console or create a new notebook and other files.

Click on the Python 3.9 Notebook button to create a new notebook. Rename the notebook from
Untitled.ipynbtoHelloWorld.ipynb. Write print (Hello World) in the notebook cell and press Shift + Enter to run the cell. After saving the file, you will see a green circle next to theHelloWorld.ipynbfile in the file explorer panel. This green circle indicates a changed file in the environment.
Go to the Git tab on the left and click the + button on
HelloWorld.ipynbto stage the file.

Add a comment and click Commit, then click Push to push to the repo.

Get a breakdown of the JupyterLab git operations. And check out the JupyterLab with default Git integration (Watson Studio) documemtation for more info.
Step 4. Creating and running a notebook job within IBM Cloud Pak for Data
IBM Cloud Pak for Data can create and schedule jobs to run periodically. Here, we will create a job with the HelloWorld.ipynb.
In the Assets tab within your project, click View local branch.

In the pop-up window, click New code job.

Select
HelloWorld.ipynbas the asset to create a job with, then proceed to Configure the job.
Progress through the configurations and optionally set a schedule, then click Create.

Click Run in the upper right, and a new run will be created and show in the Runs window.

You can see the Hello World print result in the log of the run.

Step 5. Accessing security credentials with ibm-watson-studio-lib
IBM Cloud Pak for Data projects have the ability to import data assets into notebooks with the ibm-watson-studio-lib Python package. In situations where a security credential is needed, for example, with a database connection, a JSON file with credential information can be used. This allows for the security details to remain hidden and secure from being pushed to GitHub.
Upload your credential file or, as shown, an SSL certificate to the project data assets.

In your notebook, import ibm_watson_studio_lib (a package that should be pre-installed within this IBM Cloud Pak for Data Python environment). Follow the screenshot below for accessing the stored data in data assets.

The IBM Cloud Pak for Data documentation for ibm-watson-studio-lib for Python explains the usage of this package.
Summary
In this tutorial, you successfully created a project integrated with a GitHub repository in IBM Cloud Pak for Data. You learned how to add collaborators with their own personal access tokens to the repository, as well as how to navigate the UI within IBM Cloud Pak for Data to push and pull changes to the Git branch. You also created a notebook to test out these interactions to get hands-on practice.
More information
When working with GitHub, it is common to run into conflict scenarios. The IBM Cloud Pak for Data documentation for Git operations provides common scenarios and resolutions that you may run into.