Skip to content

How To Configure a Git Provider#

Introduction#

When you perform Git operations on Hopsworks that need to interact with the remote repository, Hopsworks relies on the Git HTTPS protocol to perform those operations. Authentication with the remote repository happens through a token generated by the Git repository hosting service (GitHub, GitLab, BitBucket).

Beta

The feature is currently in Beta and will be improved in the upcoming releases.

Token permissions

The token permissions should grant access to public and private repositories including read and write access to repository contents and commit statuses. If you are using the new GitHub access tokens, make sure you choose the correct Resource owner when generating the token for the repositories you will want to clone. For the Repository permissions of the new GitHub fine-grained token, you should atleast give read and write access to Commit statuses and Contents.

UI#

Documentation on how to generate a token for the supported Git hosting services is available here:

Step 1: Navigate to Git Providers#

You can access the Git Providers page of your Hopsworks cluster by clicking on your name, in the top right corner, and choosing Account Settings from the dropdown menu. The Git providers section displays which providers have been already configured and can be used to clone new repositories.

Git provider configuration list
Git provider configuration list

Step 2: Configure a provider#

Click on Edit Configuration to change a provider username or token, or to configure a new provider.

Tick the checkbox next to the provider you want to configure and insert the username and the token to use for that provider.

Git provider configuration
Git provider configuration

Click Create Configuration to save the configuration.

Step 3: Provider is configured#

The configured provider should now be marked as configured.

Git provider configured
Git provider configured

Code#

You can also configure a git provider using the hopsworks git API in python.

Step 1: Get the git API#

import hopsworks

project = hopsworks.login()

git_api = project.get_git_api()

Step 2: Configure git provider#

PROVIDER="GitHub"
GITHUB_USER="my_user"
API_TOKEN="my_token"

git_api.set_provider(PROVIDER, GITHUB_USER, API_TOKEN)

API Reference#

GitProvider

Conclusion#

In this guide you learned how configure your git provider credentials. You can now use the credentials to clone a repository from the configured provider.