Enabling access to a Git repository
To support collaboration with stakeholders and the data science community at large, you can integrate your project with Git. You can use this integration feature to share assets between projects, to work with documents and notebooks in JupyterLab, or as a method to backup project assets for source code management purposes.
You must enable Git integration at the time you create a project:
- To work with notebooks in the JupyterLab IDE
-
To enable on-demand synchronization between project assets and a Git repository. This enables:
- Pulling notebook changes pushed from JupyterLab
- Exporting assets from the project to enable creating a new project from Git
- To create a project from assets that were exported to a Git repository
Important: Each project must have its own Git repository. No two projects can use the same Git repository. This is especially relevant when working in projects with JupyterLab. You can’t create a project to work with JupyterLab and associate your new project with the Git repository that you used in another project with JupyterLab.
If you are using a Git server, you will need to allow network traffic between the compute nodes on your Watson Studio cluster and your Git server. Check with your Git server provider to learn the specific ports that are used by your Git server.
Follow these steps to get access to a Git repository when creating a project:
- For an empty project: Select to integrate the project with Git. This selection enables synchronization between the project and the Git repository after the project is created.
-
Select an existing access token or create a new one. To create a token:
- Click New Token.
- Select the platform you want to create a personal access token for. This can be GitHub, GitHub Enterprise, GitLab or Bitbucket. Log in to the platform and follow the instructions to generate a new token with repo scope (the token must have read and write access to the repo). Tokens to Git repositories are managed at the user level, not at the project level. This means that every user must create their own token.
- Copy the generated access token, paste it in the Git integration dialog window, which opens when you click New Token, and give the token a name.
- Select this token on the create project page.
-
Enter the URL to a repository in the platform you selected. For example, to a repository in GitHub, enter
https://github.com/myName/repo4projectexport.git.Repository restrictions when creating a project:
- For an empty project:
- The repository doesn’t have to be empty, however, it can’t contain an exported project. All files in the repository will be deleted during project creation.
- If the repository is locked by another project, you can reassign the repository to your new project by deleting the
.project-lock.jsonfile. The other project loses access to the repository.
- For a project created from Git:
- The repository must contain exported project assets.
- The repository can be locked by another project. To enable synchronization between the project and the repository, you must delete the
.project-lock.jsonfile in the repository. The other project loses access to the repository.
Important: If you want to edit notebooks only in JupyterLab and want users to work with the same Git repository, you must invite them to the project as collaborators and give them Editor or Admin rights to the project. You must also give those users read/write access to the Git repository.
- For an empty project:
- After the repository is validated, you can select a branch. For GitHub, GitHub Enterprise and GitLab, you can use any branch in the repository. For Bitbucket, you must use the master branch of the repository.
- For a project created from Git: If you deleted the
.project-lock.jsonfile, select to enable on-demand synchronization between the project and the Git repository. - To work in the Jupyterlab IDE, select to edit notebooks only in JupyterLab.