Skip to main content
This guide explains how to set up Git repository initialization for existing feature flag configurations in Flipt v2. This is particularly useful when you already have features.yaml or features.yml files but need to initialize version control for them.

Overview

Flipt v2 supports automatic Git repository detection and initialization for existing feature files when using the local storage backend. This addresses the common workflow where you have existing feature flag configurations but no Git repository initialized yet.
This is only necessary if you want to pre-populate Flipt with existing feature data from your local machine.If you are starting fresh or have data synced to a remote repository then following this guide is not necessary.

Supported File Formats

Flipt v2 supports both YAML file extensions for feature configurations:
  • features.yaml (recommended)
  • features.yml
Both formats work identically and you can use whichever extension you prefer.

Basic Setup Workflow

The typical workflow for initializing a Git repository with existing feature files is:

1. Organize Your Feature Files

Create a directory structure with your existing features:

2. Initialize Git Repository

Navigate to your flags directory and initialize Git:

3. Configure Flipt

Create a Flipt configuration that points to your flags directory:

4. Start Flipt Server

Run Flipt pointing to your configuration:

Repository Detection

Flipt v2 includes enhanced repository detection logic that can handle:
  1. Normal Git Repositories: Standard repositories created with git init (with .git subdirectory)
  2. Bare Repositories: Repositories managed internally by Flipt (Git files in root directory)
  3. Automatic Fallback: Graceful handling when repository types are ambiguous
The system automatically:
  • Detects the repository type
  • Creates necessary remote tracking references (refs/remotes/origin/main)
  • Sets up proper branch management for Flipt’s operations

Working Directory Synchronization

When you make changes through the Flipt UI, the system automatically:
  • Updates the actual .yaml files on disk for normal repositories
  • Maintains backward compatibility with existing bare repository workflows
  • Synchronizes changes back to the filesystem
This means changes made in the Flipt web interface will be reflected in your actual feature files, allowing you to see modifications through standard Git tools.

Configuration Examples

Basic Local Storage

Multiple Environments

With Remote Git Repository

You can also combine local storage with remote Git synchronization:

Docker Usage

When using Docker, you can initialize the repository in your container build process:

Troubleshooting

Repository Does Not Exist Error

If you see this error, ensure that:
  1. Your path configuration points to a valid directory
  2. The directory contains your feature files
  3. Git is properly initialized in the directory

Features Not Loading

Check that:
  1. Your feature files use the correct naming: features.yaml or features.yml
  2. The files are in the correct directory structure
  3. The YAML syntax is valid
  4. You added and committed the files at path

Backward Compatibility

This enhancement is fully backward compatible:
  • Existing bare repository workflows continue to work unchanged
  • All existing functionality is preserved
  • Safe fallbacks handle edge cases gracefully
You can migrate existing setups without any breaking changes.