Skip to main content
Version: Next

Git remotes

In OpsChain, a Git remote is a named reference to an actual Git remote. It is used to securely store the credentials to access a Git repository from which you can run changes.

The Git repository is where you store the actions and related configuration. OpsChain will read all action and resource definitions from the actions.rb file in the repository root directory and the template's actions.rb file in their respective directories. See the actions reference guide for further information about the contents of the actions.rb file.

Git remotes are also the basis for asset templates, which are used to leverage your assets within OpsChain.

The Git remotes tab inside a project allows you to connect Git repositories to your project, making them available for use in your changes and to be used as a source for asset templates.

Understanding Git revisions

A Git revision is a specific point in the history of a Git repository. It can be a branch name, a tag or a commit SHA.

  • Branch Name: A branch is a pointer to a specific commit, which moves as new commits are added, for example, main or develop branches.
  • Commit SHA: Every commit in Git has a unique SHA-1 hash, which is a 40-character string. You can use this hash to refer to a specific commit. For example, e9f227c9a4c5c9a72134a6cb23a7e4e1e4a6d18a. You can also use the SHA's prefix to refer to it, like e9f227c for this example.
  • Tags: A tag is a reference to a specific commit, often used to mark release points like v1.0.0.

To learn more about Git revisions, you can read the official Git documentation on revisions.

Authentication

GitHub authentication

If your Git repository is hosted on GitHub, you will need to authenticate with GitHub to access the repository. The service has discontinued password authentication, so if you don't already have one, you will need to create a GitHub personal access token (PAT) and use it as your password.

SSH authentication

OpsChain also supports the use of SSH keys for authentication. By default, OpsChain includes a bundled SSH known_hosts file which includes SSH keys for a number of common source code hosting platforms, including:

  • Bitbucket
  • GitHub
  • GitLab

If you'd like to have support for other platforms, refer to the customising the SSH known_hosts file guide.

The Git remote is tested when you create the Git remote and, if your SSH key is not trusted by the known_hosts list, the remote will not be added.

Project Git remotes list

Project Git remotes screen

Each row includes:

ColumnDescription
NameThe name assigned to the Git remote.
URLThe Git repository URL that the Git remote points to.
UserIndicates whether a username credential has been supplied.
PasswordIndicates whether a password credential has been supplied.
SSH Key dataIndicates whether an SSH key credential has been supplied.
ArchivedWhether the Git remote is archived or active.
Edit git remoteOpens a dialog to update the Git remote name and credentials.
Buttons & linksFunction
Bulk actionsAllows you to archive or restore multiple Git remotes.
Search barFilter the contents of the table based on these criteria.
ColumnsHide or display columns in the table.
Add Git remoteOpens a dialog to create a new Git remote.

Archiving a Git remote

Archive one or more Git remotes by selecting them in the Git remotes table and choosing Archive from the Bulk actions menu.

  • Archived Git remotes cannot be used to create new changes, asset templates or scheduled changes.
  • Existing changes, asset templates and audit history that reference the archived Git remote remain accessible.
  • The on-disk repository folder is preserved so the change audit trail stays intact.

Creating a Git remote

Create Git remote screen

To create a new Git remote, follow these steps:

  1. Click on the Add Git remote button.
  2. Fill in the mandatory fields in the dialog, including the name and the Git repository URL.
  3. Add the credentials to access the Git repository, either user and password or an SSH key (and its passphrase if it requires one).
  4. Click the Add git remote button. If successful, the new Git remote will appear on the Git remotes list of the project.