n8n-docs/docs/environments/version-control/setup.md
Deborah Barnard 09def59fa1 wip
2023-06-05 15:58:36 +01:00

2.2 KiB

description
Link n8n to your Git provider and configure your environments.

Set up version control

Link a Git repository to an n8n instance and configure your environments.

Prerequisites

To use version control with n8n, you need a Git repository that allows SSH access.

This document assumes you are familiar with Git and your Git provider.

Step 1: Set up your repository and branches

For a new setup, configure the repository to support the environments you need:

  1. Create a new repository for use with n8n.

  2. Create the branches you need. For example, if you plan to have different environments for test and production, set up a branch for each.

    !!! warning "Create branches before connecting n8n" You must create the branches you need before connecting to n8n. n8n doesn't detect any branches created after connection. [TODO: check this is still the case before publishing]

Step 2: Configure Git in n8n

  1. In n8n, go to Settings > Version Control.
  2. Enter the details for your Git repository:
    1. Git repository URL: the SSH URL for your repository.
    2. Commit author name: the username for the Git account that owns the repository.
    3. Commit author email: the email address for the Git account that owns the repository.
  3. Copy the SSH key.

Step 3: Set up Git access

Set up SSH access by creating a deploy key for the repository using the SSH key from n8n. The key must have write access.

The steps depend on your Git provider. Help links for common providers:

Step 4: Connect n8n and configure your environment

  1. In Settings > Version Control in n8n, select Connect. n8n connects to your Git repository.
  2. Under Instance settings, choose which branch you want to use for the current n8n instance.
  3. Optional: select Read-only instance to prevent users editing workflows in this instance. This is useful for protecting production instances.
  4. Select Save settings.