Git Management
Prerequisites
Hyve uses your systemβs git binary for all repository operations. Git must be installed and available in your PATH before using any hyve git commands.
# Verify git is installedgit --versionIf git is not installed, download it from git-scm.com or install via your package manager:
# macOSbrew install git
# Ubuntu / Debiansudo apt install git
# Windowswinget install Git.GitOverview
Hyve uses Git repositories to store all cluster state, workflows, and templates. This guide covers repository management, branching, synchronization, and multi-environment workflows.
Repository Basics
Adding Repositories
Add a Git repository to store your infrastructure state:
# Add a repositoryhyve git add production --repo-url https://github.com/company/hyve-prod.git
# Add and set as the active repository immediatelyhyve git add staging \ --repo-url https://github.com/company/hyve-staging.git \ --set-currentListing Repositories
hyve git listOutput:
π Configured Git repositories (3):
production (current) β URL: https://github.com/company/hyve-prod.git Local: /Users/username/.hyve/repositories/production Added: 2026-01-15 09:30
staging URL: https://github.com/company/hyve-staging.git Local: /Users/username/.hyve/repositories/staging Added: 2026-01-15 09:32
development URL: https://github.com/company/hyve-dev.git Local: /Users/username/.hyve/repositories/development Added: 2026-01-15 09:34Switching Repositories
# Switch to a different repositoryhyve git use staging
# Check current repositoryhyve git statusRemoving Repositories
# Remove a repositoryhyve git remove development
# Reset all repositories (clean slate)hyve git resetBranch Management
Listing Branches
# List all brancheshyve git branch listOutput:
πΏ Branches in repository 'production':
feature/add-staging-cluster (abc12345)* main (def56789) feature/update-workflows (ghi90123)Creating Branches
# Create a new branchhyve git branch create feature/new-cluster# Create and switch to new branchhyve git branch create feature/staging --switch# Create, switch, and push to remotehyve git branch create feature/updates --switch --pushSwitching Branches
# Switch to existing branchhyve git branch switch develop
# Switch and pull latest changeshyve git branch switch main --pullDeleting Branches
# Delete a branchhyve git branch delete feature/old-config
# Force deletehyve git branch delete feature/experimental --forceSynchronization
Pull Changes
Pull latest changes from the remote:
hyve git pullPush Changes
Push local changes to the remote:
# Push with custom messagehyve git push "Updated cluster configuration"
# Push with default message (auto-generated from changes)hyve git pushSync (Pull + Push)
Synchronize both ways:
# Sync with custom messagehyve git sync --message "Synced infrastructure changes"
# Sync (pull only, no local changes to push)hyve git syncWorkflow:
- Pulls latest changes from remote
- If local changes exist, commits them with your message
- Pushes to remote
Authentication
Hyve delegates all git operations to the system git binary. Authentication is handled by git itself β configure it the same way you would for any other git workflow.
Recommended: Personal Access Token via Environment Variable
# Set for the current sessionexport HYVE_GIT_TOKEN=your_personal_access_token
# Persist in your shell profileecho 'export HYVE_GIT_TOKEN=your_token' >> ~/.bashrcHyve reads HYVE_GIT_TOKEN and passes it to git when cloning and pushing.
Alternative: Git Credential Manager
Use gitβs built-in credential storage so you donβt need to set environment variables:
# macOS β Keychain (usually preconfigured)git config --global credential.helper osxkeychain
# Windows β Git Credential Manager (included with Git for Windows)git config --global credential.helper manager
# Linuxgit config --global credential.helper storeOnce configured, git will prompt for credentials on first use and cache them automatically.
Alternative: SSH Keys
Use SSH URLs instead of HTTPS to authenticate with SSH keys:
hyve git add production --repo-url git@github.com:company/hyve-prod.gitEnsure your SSH key is added to your git host and loaded into ssh-agent:
ssh-add ~/.ssh/id_ed25519Multi-Environment Workflows
Scenario: Dev, Staging, Production
Set up repositories
# Developmenthyve git add development \ --repo-url https://github.com/company/hyve-dev.git
# Staginghyve git add staging \ --repo-url https://github.com/company/hyve-staging.git
# Productionhyve git add production \ --repo-url https://github.com/company/hyve-prod.gitConfigure each environment
# Development clustershyve git use developmenthyve cluster add dev-app --provider civo --region PHX1 --nodes g4s.kube.small
# Staging clustershyve git use staginghyve cluster add staging-app --provider civo --region NYC1 --nodes g4s.kube.medium
# Production clustershyve git use productionhyve cluster add prod-app --provider civo --region NYC1 --nodes g4s.kube.largeManage independently
Each repository maintains its own:
- Cluster definitions
- Workflows
- Templates
- Kubeconfigs (encrypted per repository)
Branch-Based Environments
Use branches within a single repository:
# Main repositoryhyve git add infrastructure --repo-url https://github.com/company/infra.git
# Development branchhyve git branch create develop --switchhyve cluster add dev-cluster --provider civo --region PHX1 --nodes g4s.kube.small
# Staging branchhyve git branch create staging --switchhyve cluster add staging-cluster --provider civo --region NYC1 --nodes g4s.kube.medium
# Production in mainhyve git branch switch mainhyve cluster add prod-cluster --provider civo --region NYC1 --nodes g4s.kube.largeRepository Structure
Each repository follows this structure:
repository/βββ clusters/ # Cluster definitionsβ βββ production.yamlβ βββ staging.yamlβ βββ dev-cluster.yamlβββ workflows/ # Workflow definitionsβ βββ deploy-app.yamlβ βββ setup-monitoring.yamlβ βββ backup-db.yamlβββ templates/ # Cluster templatesβ βββ prod-template.yamlβ βββ staging-template.yamlβ βββ dev-template.yamlβββ .gitignore # Ignore temporary filesBest Practices
1. Use Descriptive Repository Names
# Goodhyve git add production-us-easthyve git add production-eu-westhyve git add staging-shared
# Avoidhyve git add repo1hyve git add my-clusters2. Regular Synchronization
# At start of dayhyve git pull
# Before making changeshyve git pull
# After making changeshyve git push "Your changes description"
# Or use sync for bothhyve git sync --message "Daily sync"3. Branch for Experimental Changes
# Create feature branchhyve git branch create feature/test-new-cluster --switch
# Make changeshyve cluster add test-cluster --provider civo --region PHX1 --nodes g4s.kube.small
# Test and verifyhyve reconcile
# Merge to main when readyhyve git branch switch main# Manually merge via Git or pull request4. Separate Repositories for Environments
Use different repositories for different environments to:
- Isolate configurations
- Control access permissions
- Prevent accidental changes
- Enable different Git workflows per environment
5. Commit Messages
# Descriptive messageshyve git push "Add production cluster for US region"hyve git push "Update workflow to include monitoring setup"hyve git push "Scale production cluster to 5 nodes"
# Avoid vague messageshyve git push "Update"hyve git push "Changes"Troubleshooting
git: command not found
Problem: Hyve cannot find the git binary
Solution: Install git and ensure it is in your PATH:
# Verify installationgit --version
# macOSbrew install git
# Ubuntu / Debiansudo apt install git
# Windowswinget install Git.GitAuthentication Failed
Problem: Git operations fail with authentication error
Solutions:
# Set token via environment variableexport HYVE_GIT_TOKEN=your_personal_access_token
# Or configure git credential managergit config --global credential.helper osxkeychain # macOSgit config --global credential.helper manager # Windows
# For SSH: verify your key is loadedssh-add -lssh -T git@github.comMerge Conflicts
Problem: Git pull fails due to conflicts
Solutions:
# Navigate to repositorycd ~/.hyve/repositories/production
# Check statusgit status
# Resolve conflicts manually# Edit conflicting files
# Commit resolutiongit add .git commit -m "Resolve merge conflicts"
# Push resolved changeshyve git push "Resolved conflicts"Repository Not Found
Problem: No Git repository configured error
Solution:
# Add a repositoryhyve git add production --repo-url https://github.com/company/hyve-prod.git
# Verify it's addedhyve git list
# Set as active if neededhyve git use productionLocal Changes Conflict
Problem: Canβt switch repositories/branches with uncommitted changes
Solutions:
# Option 1: Commit and push changeshyve git push "WIP: In progress work"
# Option 2: Stash changes manuallycd ~/.hyve/repositories/productiongit stash# Switch repositories/branches# Later: git stash pop
# Option 3: Discard changes (careful!)cd ~/.hyve/repositories/productiongit reset --hard HEADAdvanced Workflows
Team Collaboration
# Team member 1hyve git pull # Get latesthyve cluster add new-cluster # Make changeshyve git push "Add new cluster" # Push changes
# Team member 2hyve git pull # Pull changes from team member 1# See new cluster automaticallyhyve reconcile # Apply changesMulti-Region Setup
# US Regionhyve git add us-infrastructure \ --repo-url https://github.com/company/hyve-us.git
hyve cluster add us-cluster --provider civo --region NYC1 --nodes g4s.kube.large
# EU Regionhyve git add eu-infrastructure \ --repo-url https://github.com/company/hyve-eu.git
hyve git use eu-infrastructurehyve cluster add eu-cluster --provider civo --region FRA1 --nodes g4s.kube.largePromotion Workflow
# Develop in dev repositoryhyve git use developmenthyve workflow create deploy-v2 --template deployment-pipeline
# Test in staging# Copy workflow file to staging repocp ~/.hyve/repositories/development/workflows/deploy-v2.yaml \ ~/.hyve/repositories/staging/workflows/
hyve git use staginghyve git push "Add deploy-v2 workflow"hyve workflow run deploy-v2 --cluster staging-cluster
# Promote to production after testingcp ~/.hyve/repositories/staging/workflows/deploy-v2.yaml \ ~/.hyve/repositories/production/workflows/
hyve git use productionhyve git push "Promote deploy-v2 workflow to production"