Skip to main content

Git Integration

MINEO's Git integration facilitates seamless version control by allowing users to interact with Git repositories directly within the file explorer.

How to Checkout a Repo

To check out a repository:

  1. Navigate to the file explorer within your project.
  2. Click the "+" button and select Import from git.
  3. Enter the repository's URL and configure your SSH keys if required to ensure secure communication with the Git server. Optionally, you can specify a branch if you wish to update a specific one.

Configuring SSH Keys

Before cloning a private repository, you may need to configure SSH keys.

Step 1: Generate SSH Keys in MINEO

To do this, go to Project settings → Integrations and generate a pair of SSH keys. MINEO shows the generated public key to copy.

An organization administrator can instead generate one key under Organization settings → Integrations. Git operations use the project's own key and fall back to the organization's key when the project has none, so a single organization key can serve every project.

Step 2: Add the Public Key to Your Git Provider

Once generated, you must add the public SSH key to your Git provider account:

For GitLab:

  1. Copy the public key from MINEO
  2. Go to GitLab PreferencesSSH Keys (or User SettingsSSH Keys)
  3. Paste your public key in the "Key" field
  4. Add a descriptive title
  5. Set an expiration date (optional but recommended)
  6. Click Add key
tip

The public key typically starts with ssh-rsa, ssh-ed25519, or similar. Make sure to copy the entire key including the prefix and any trailing comment.

info

After adding the SSH key to your Git provider, you can use SSH URLs when importing repositories in MINEO:

  • Standard SSH: git@gitlab.com:username/repo.git or git@github.com:username/repo.git
  • SSH with custom port: ssh://git@gitlab.your-company.com:622/username/repo.git

Using GitHub repositories with MINEO

For write actions or private GitHub repositories, you can use Personal Access Tokens (PAT).

Step 1: Generate a GitHub Personal Access Token

  1. Go to GitHub SettingsDeveloper settingsPersonal access tokensTokens (classic)
  2. Click Generate new token (classic)
  3. Give it a descriptive name and select the repo scope for full repository access
  4. Copy the generated token immediately (you won't be able to see it again)

Step 2: Clone Using the Token in MINEO

When importing a repository in MINEO's file system, use the following URL format:

https://TOKEN@github.com/USERNAME/REPOSITORY.git

Example with a real token format:

https://ghp_abc123DEF456ghi789JKL012mno345pqr678@github.com/your-username/your-repo.git

How to Construct the URL

  1. Get the standard HTTPS clone URL from GitHub (usually: https://github.com/username/repo.git)
  2. Simply insert your token followed by @ right after https://
  3. The pattern is: https://{token}@github.com/username/repo.git

Using Tokens in Notebooks

You can also use tokens directly in your notebooks: Or use MINEO's project environment variables

# Clone a private repo in a notebook cell
!git clone https://ghp_abc123...@github.com/username/private-repo.git

# Or set as remote origin
!git remote set-url origin https://ghp_abc123...@github.com/username/private-repo.git

Security Notes

  • 🔒 Never commit tokens to version control
  • 🗑️ Rotate tokens regularly
  • 📋 Use environment variables for tokens in production code
  • 🔐 Tokens provide full repository access - protect them like passwords

Using GitLab repositories with MINEO

For write actions or private GitLab repositories, you can use Personal Access Tokens (PAT) or Project Access Tokens.

Step 1: Generate a GitLab Personal Access Token

  1. Go to GitLab SettingsAccess Tokens (or User SettingsAccess Tokens)
  2. Enter a name for your token (e.g., "MINEO Integration")
  3. Set an expiration date (optional but recommended)
  4. Select the required scopes:
    • read_repository - for read-only access
    • write_repository - for push access
    • api - for full API access (includes read/write)
  5. Click Create personal access token
  6. Copy the generated token immediately (you won't be able to see it again)

Step 2: Clone Using the Token in MINEO

When importing a repository in MINEO's file system, use the following URL format:

https://oauth2:TOKEN@gitlab.com/USERNAME/REPOSITORY.git

For self-hosted GitLab instances:

https://oauth2:TOKEN@gitlab.your-company.com/username/repo.git

How to Construct the URL

  1. Get the standard HTTPS clone URL from GitLab (usually: https://gitlab.com/username/repo.git)
  2. Insert oauth2: followed by your token and @ right after https://
  3. The pattern is: https://oauth2:{token}@gitlab.com/username/repo.git

Alternative: Using Username and Token

GitLab also supports using a username with the token:

https://USERNAME:TOKEN@gitlab.com/username/repo.git

Additional Git Actions

To perform the git actions, you need to navigate to the cloned repository in your file explorer. Once inside the repository, you can perform various Git operations from its context menu to manage and synchronize your code effectively.

  • Update the Repository: To update your local repository with the latest changes from the remote repository, simply press Pull. This will integrate the new changes, ensuring your code is up to date. Additionally, a --force option has been added, which can be selected if you need to override local changes and force synchronization with the remote repository.

  • Commit and Push Changes: After modifying files, press Commit and Push to confirm and upload your changes to the remote repository in a single action.

  • Check the Repository Status: You can check the current status of your repository by pressing Status. This will display a summary of the changes in your working directory.

  • Revert Changes: To undo local changes in files, press Revert. This allows you to go back if necessary without altering the repository history.

  • Resolve Merge Conflict (Use Remote Changes): If you encounter a merge conflict when running Commit and Push, selecting the Merge(theirs) option will resolve the conflict by discarding your local changes and keeping those from the remote repository.

  • Resolve Merge Conflict (Keep Local Changes): If you encounter a merge conflict when running Commit and Push, selecting the Merge(ours) option will resolve the conflict by keeping your local changes and discarding those from the remote repository.

This integration ensures that developers can manage code changes and maintain synchronization with their team’s work directly from the MINEO environment.