Skip to main content

Creating Git Credentials

This guide explains how to create and use Git credentials for deploying private repositories to Clue2App, using either the Console UI or the CLI.

Creating a GitHub Personal Access Token

Before adding credentials to Clue2App, you need to create a Personal Access Token (PAT) on GitHub.

  1. Go to GitHub Settings → Developer settings → Personal access tokens → Fine-grained tokens

  2. Click "Generate new token"

  3. Configure your token:

    • Token name: clue2app-deploy (or any descriptive name)
    • Expiration: Choose based on your security requirements
    • Repository access: Select "Only select repositories" and choose the repos you want to deploy
  4. Required permissions (under Repository permissions):

    PermissionAccess LevelWhy it's needed
    ContentsRead-onlyTo clone and read your source code
    MetadataRead-onlyRequired for all tokens (auto-selected)
  5. Click "Generate token" and copy the token immediately (it won't be shown again)

Classic Tokens (Alternative)

If you prefer classic tokens:

  1. Go to GitHub Settings → Personal access tokens (classic)
  2. Click "Generate new token (classic)"
  3. Select the repo scope (Full control of private repositories)
  4. Generate and copy the token
Which Token Type?
  • Fine-grained tokens (recommended): More secure, scoped to specific repos
  • Classic tokens: Simpler setup, broader access
Keep Your Token Secure
  • Never commit tokens to your repository
  • Store tokens securely
  • Rotate tokens periodically
  • Use fine-grained tokens with minimal permissions when possible

Using the Console UI

1. Navigate to Git Credentials

From the Advanced menu, click on Git Repositories to access the Git credentials management page.

Manage Git Credentials

2. Create New Credentials

Click on the Add New button to open the credential creation dialog.

Create Git Credentials

3. Fill in Credential Details

In the dialog, enter the required details:

  • Name: A name to identify your credentials (e.g., my-github-creds)
  • Username: Your GitHub username
  • Password / Token: The Personal Access Token you created above

4. Save Your Credentials

Click the Save button to store your credentials. The modal window will close, and you'll see your newly created credentials displayed in the list.

5. Using the Credentials in a New Application

When creating a new application, you can directly select these credentials from the dropdown menu in the Source Code Info section.

Credentials Showing Up in Dropdown

6. Create Credentials On-the-Fly

If you need to create new credentials directly from the project creation page, select Private under Git Access Type, and choose New credentials from the dropdown. This will allow you to enter your credentials on the fly.

New Project Git Credentials


Using the CLI

Option 1: Automatic (Using GitHub CLI)

If you have the GitHub CLI installed and authenticated, the Clue2App CLI will automatically use your credentials:

# First, authenticate with GitHub CLI (one-time setup)
gh auth login

# Then create your app - credentials are detected automatically
c2a apps create my-private-app \
--git-url https://github.com/myorg/private-repo.git \
--branch main

Option 2: Explicit Credentials

Provide credentials directly when creating an app:

c2a apps create my-private-app \
--git-url https://github.com/myorg/private-repo.git \
--branch main \
--git-username your-github-username \
--git-token ghp_xxxxxxxxxxxxxxxxxxxx

For better security, especially in automated pipelines:

export GIT_USERNAME="your-github-username"
export GIT_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxx"

c2a apps create my-private-app \
--git-url https://github.com/myorg/private-repo.git \
--branch main \
--git-username $GIT_USERNAME \
--git-token $GIT_TOKEN

Troubleshooting

"Authentication failed" Error

  • Verify your token hasn't expired
  • Ensure the token has the correct permissions (Contents: Read)
  • Check that the token has access to the specific repository

"Repository not found" Error

  • Confirm the repository URL is correct
  • For fine-grained tokens, verify the repository is included in the token's repository access

Token Expired

  • Generate a new token following the steps above
  • Update your credentials in the Console UI or use the new token with the CLI