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.

Tokens are personal

The tokens are personal to each user. When you perform operations on a repository, your token is going to be used, even though the repository might belong to a different user.

UI#

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

Step 1: Navigate to Git Providers#

In the Account Settings page you can find the Git Providers section. The Git provider 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#

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.