How To Configure a Git Provider#
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).
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.
Documentation on how to generate a token for the supported Git hosting services is available here:
Step 1: Navigate to Git Providers#
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.
Step 2: Configure a provider#
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.
Create Configuration to save the configuration.
Step 3: Provider is configured#
The configured provider should now be marked as configured.
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)
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.