iagctl create repository
Create a new repository.
The iagctl create repository command creates a repository in the gateway data store. A repository is a reference to a Git repository on an external server. The gateway pulls the repository each time you run a service, so the content is always current.
For more information, see Git repositories in IAG.
To reference a specific branch or SHA in your Git repository, use the --reference flag.
Syntax
Examples
Create a public repository
The following example creates a repository called my-public-repo. This command assumes the Git repository is publicly accessible and doesn’t require authentication:
Create a repository with a specific branch
The following example creates a repository called my-branch-reference that pulls down the devel branch when you run services:
Create a private repository
The following example creates a repository called my-private-repo that references a secret called git-key in the gateway’s secret store. This example assumes you’ve already created the secret by following the steps in Set up a private repository:
Set up a private repository
If your repository isn’t publicly accessible, you need to give the gateway access to a private SSH key with read access to the repository on your Git server. Itential recommends creating an SSH key exclusively for the gateway.
The following steps demonstrate how to add a key for use with GitLab, but your specific steps may vary.
- Generate a public/private SSH key pair. Don’t overwrite any existing keys.
-
Upload the newly generated public key to your Git server. This process varies by Git provider.
-
Set up secret storage in the gateway. This requires a separate encryption key, unrelated to SSH, for handling gateway secrets. For more information, see iagctl create secret.
-
Encrypt the private key into the gateway secret store using the encryption key file from step 3:
- Create the repository and reference the secret with the
--private-key-nameflag:
For more information, see Use SSH keys to clone git repositories.