> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# Configure access to private repositories

> Configure HTTP basic authentication to access private Git repositories using a username and personal access token.

You can configure HTTP basic authentication to access private Git repositories that use HTTP or HTTPS URLs. This authentication method uses a username and password (typically a personal access token) to access your repository.

## When to use HTTP basic authentication

Use HTTP basic authentication when:

* Your Git repository requires authentication and uses an HTTP or HTTPS URL
* You want to use a personal access token instead of SSH keys
* Your organization's security policies require token-based authentication
* You need to access repositories on platforms like GitHub, GitLab, or Bitbucket with HTTPS URLs

## Prerequisites

* Gateway secret store configured with an encryption key. See [Configure Gateway secret store](./configure-secret-store). Alternatively, you can use an [external secret alias](./secrets/external-secrets/manage-secret-aliases) for the `--password-name` value instead of a local secret.
* A personal access token or password for your Git repository
* Administrator role permissions to create secrets and repositories

## How HTTP basic authentication works

Gateway stores your authentication credentials securely:

1. You create a secret that contains your password or personal access token
2. You create a repository and reference the secret by name
3. When a service runs, Gateway uses the stored credentials to access the repository

Gateway never exposes your password or token in plain text.

## Create a secret for your authentication token

Before you create a repository with HTTP basic authentication, create a secret to store your personal access token or password.

Use the `iagctl create secret` command with the `--prompt-value` flag:

```bash
iagctl create secret <secret-name> --prompt-value
```

Example:

```bash
iagctl create secret github-token --prompt-value
```

When prompted, enter your token. Gateway encrypts and stores the token securely.

## Create a repository with HTTP basic authentication

After you create a secret, you can create a repository that uses HTTP basic authentication.

Syntax:

```bash
iagctl create repository <repository-name> \
  --url <https-git-url> \
  --username <git-username> \
  --password-name <secret-name>
```

Parameters:

| Parameter           | Description                                                 |
| ------------------- | ----------------------------------------------------------- |
| `<repository-name>` | A unique name for the repository reference                  |
| `--url`             | The HTTPS Git URL for your repository                       |
| `--username`        | Your Git username                                           |
| `--password-name`   | The name of the secret that contains your password or token |

Example — create a repository that uses GitHub authentication:

```bash
iagctl create repository my-private-repo \
  --url https://github.com/example/some-private-repo-with-automations.git \
  --username your-username \
  --password-name github-token
```

### Complete example workflow

This example shows the complete process of setting up HTTP basic authentication for a GitHub repository.

#### Create a secret for your GitHub token

See [Configure Gateway secret store](./configure-iag-secret-store#create-your-first-secret) for details.

```bash
iagctl create secret github-token --prompt-value
```

ß

#### Create a repository with authentication

```bash
iagctl create repository my-private-repo \
  --url https://github.com/example/automation-scripts.git \
  --username myusername \
  --password-name github-token
```

#### Create a service that uses the repository

```bash
iagctl create service executable backup-service \
  --executable-object bash-standard \
  --repository my-private-repo \
  --working-dir scripts \
  --filename backup.sh
```