Configuring Git settings

To configure r10k to use a specific Git provider, a private key, a proxy, or multiple Git source repositories, specify the git_settings parameter.

The r10k git_settings parameter accepts a hash that can use the private_key, provider, proxy, username, and repositories keys. For example:

pe_r10k::git_settings:
  provider: "rugged"
  private_key: "/etc/puppetlabs/puppetserver/ssh/id-control_repo.ed25519"
  username: "git"

private_key

The private-key setting is required, and, if it is not specified, it gets a default value from the puppet_enterprise::profile::master class.

Use private-key to specify the path to the file containing the default private key that you want Code Manager to use to access control repos, for example:

/etc/puppetlabs/puppetserver/ssh/id-control_repo.ed25519
The pe-puppet user must have read permissions for the private key file, and the SSH key can't require a password.

provider

Allows r10k to interact with Git repositories using multiple Git providers. Valid values are rugged and shellgit.

For more information about this setting, refer to the r10k documentation on GitHub.

proxy

The proxy key sets a proxy specifically for Git operations that use an HTTP(S) transport. This setting overrides the global proxy setting but only for Git operations (For more information, refer to the global proxy setting). You can set an unauthenticated proxy or an authenticated proxy with either Basic or Digest authentication. For example:

proxy: 'http://proxy.example.com:3128'

To set a proxy for only one specific Git repository (or when you have multiple control repos), set proxy within the repositories key.

If you set a global proxy, but you don't want Git operations to use a proxy, under the git_settings parameter, set proxy to an empty string.

username

If the Git remote URL does not provide a username, supply the relevant username as a string.

repositories

The repositories key specifies a list of repositories and their respective private keys or proxies. Use repositories if:

  • You need to configure different proxy settings for specific repos, instead of all Git operations.
  • You have multiple control repos.
    If you have multiple control repos, the sources setting and the repositories setting must match.

The repositories setting accepts a hash that uses the remote, private-key, proxy, and username keys.

The remote key specifies the repository to which the subsequent private-key, username, or proxy settings apply. The private-key, username, and proxy settings have the same requirements and functions as described above, except that, when inside repositories, these settings only apply to a single repository.

For example, this repositories hash specifies a unique private key for one repo and a unique proxy for another repo:

pe_r10k::git_settings:
  repositories:
    - remote: "ssh://tessier-ashpool.freeside/protected-repo.git"
      private_key: "/etc/puppetlabs/r10k/ssh/id_rsa-protected-repo-deploy-key"
    - remote: "https://git.example.com/my-repo.git"
      proxy: "https://proxy.example.com:3128"

If you set a global proxy or a git_settings proxy, but you don't want a specific repo to use a proxy, in the repositories hash, set that specific repo's proxy to an empty string.