How do we version a project with Git?

We want to keep the history of our projects’ configuration in a Git repository, and test changes before production. How?

Each project can be linked to a Git repository, from the Versioning card of Manage the project.

Link the repository

  1. Repository: the repository’s SSH address (git@host:organization/project.git), and the Branch.
  2. SSH key: Generate a key, then add it to the repository as a deploy key (with write access to push). You can also paste an existing key, or reuse the key of another project in the organization.

Operations

  • Fetch: see where the remote branch stands.
  • Commit: records the project’s deployed version on the branch (or the files of a draft).
  • Push: pushes the branch (never forced).
  • Pull: fetches the branch and opens its files in a draft of the project, to deploy afterwards.

Production and tests

  • A production project only follows main or master, pull only.
  • Create a test project makes a separate project, on a test/<code> branch of the same repository: you try a change there, then Propose to production.

Secrets (SSH key, connection secrets) are never written to the repository.