> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.itential.com/itential-gateway/5/iagctl/create-repository/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server. # 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 Gateway](../git-repositories). To reference a specific branch or SHA in your Git repository, use the `--reference` flag. ## Syntax ```bash iagctl create repository --url [flags] ``` ## 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: ```bash iagctl create repository my-public-repo \ --url git@github.com:example/some-public-repo-with-automations.git ``` ### 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: ```bash iagctl create repository my-branch-reference \ --url git@github.com:example/some-public-repo-with-automations.git \ --reference devel ``` ### 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): ```bash iagctl create repository my-private-repo \ --url git@github.com:example/some-private-repo-with-automations.git \ --private-key-name git-key ``` ## 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. 1. Generate a public/private SSH key pair. Don't overwrite any existing keys. ```bash ssh-keygen -t rsa -b 2048 \ -C "" \ -f /Users/gatewayuser/.ssh/gateway_git_rsa ``` 2. Upload the newly generated public key to your Git server. This process varies by Git provider. 3. 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](./create-secret). 4. Encrypt the private key into the gateway secret store using the encryption key file from step 3: ```bash iagctl create secret git-key \ --value @/Users/gatewayuser/.ssh/gateway_git_rsa \ --encryption-file /Users/gatewayuser/.gateway.d/gateway_secret.key ``` 1. Create the repository and reference the secret with the `--private-key-name` flag: ```bash iagctl create repository my-private-repo \ --url git@github.com:example/some-private-repo-with-automations.git \ --private-key-name git-key ``` For more information, see [Use SSH keys to clone git repositories](../clone-git-repositories-ssh). ## Options ```bash --description string A brief description of the repository -h, --help Help for repository --private-key-name string The secret name for the private key used to retrieve the repository --reference string The reference to check out within the repository (for example, a branch or SHA) --tag stringArray Metadata tags to associate with the repository --url string The URL of the repository ``` ## Options inherited from parent commands ```bash --profile string Specify the client profile to use (case-insensitive, defaults to [client] section) --config string Path to the configuration file --raw Display the result of the command in raw format --verbose Enable verbose output ```