A Cloud Pak for Data project can be integrated with a git repository. The Git integration must be done at project creation time.
To create a token for Gitlab, login to GitLab, click on your user account in the top right and choose
From the left navigation bar select
Access tokens and fill in the name, expiration date, and check the boxes for read_repository and write_repository. Finally, click
Create personal access token button:
On the resulting page, you'll see your personal access token. Copy this.
NOTE: This token gives access to your git repository. Do not share with anyone.
Go the (☰) navigation menu and click on the Projects link.
Click on the New project button on the top right.
Analytics project radio button and click the Next button.
We are going to create an empty project. Select the Create an empty project option.
Give the project a name and Click the box for
Integrate this project with git. Then click the
New Token link on the right.
In the Git Integration panel: select the Gitlab option from the Platform drop down list, Paste in your access token from the previous section, Enter your GitLab username, provide a name to the token. Then click the
Now select the token you just created in the Token drop down list. Put in the repository URL, Select a branch, and click
Note: We are assuming you have a project already created in the repository that you will synch to. If not, go ahead and create an empty project in GitLab
Now whenever we create an asset in the project, we will be able to push it to the GitLab repository.
From the project overview, either click the
Add to project + button, and choose
On the 'New notebook' panel, give the notebook a name and optional description. Leave the default runtime. Click the
Create notebook button.
We can start making changes to the notebook but first lets sync with the repository. Go back to the top-level project page by clicking on the project name in the navigation hierarchy in the top left of the page.
Click the "circular arrow" sync-icon and choose the
Pull and Push option from the menu.
On the Confirm Sync page, select your token, check the box next to your notebook, and click the
A window will come up asking you to verify "Did you remove credentials from assets?". After confirming this, click the
Continue export button.
After syncing, the window will show Success. You can click the
Back to project button.
You can check your GitLab project to see the notebook has been added under the 'assets' directory.
In this section we covered how to enable the Git integration to your projects in Cloud Pak for Data. You can integrate git into your workflow in your usual way, syncing with teammates via 'git pull' and using 'git push' to upload your changes to the git remote repository.