Skip to content
Docs

'hyve git'

The hyve git command group manages Git repositories for state management in Hyve. All cluster configurations, workflows, and templates are stored in Git repositories, enabling GitOps workflows and version control.

Overview

Hyve requires at least one Git repository for storing cluster state. You can configure multiple repositories for different environments (e.g., production, staging, development) and switch between them.

Commands

hyve git add

Add a new Git repository configuration for state management.

Terminal window
hyve git add [repository-name] --repo-url <url> [flags]
repository-name string required

Friendly identifier for the repository. Used when switching between repositories.

--repo-url string required

Git repository URL (HTTPS or SSH format)

--username string

Git username for authentication (stored in repository config)

--set-current boolean default: false

Set this repository as the current active repository after adding

--path string

Custom local path for the repository clone. Defaults to ~/.hyve/repositories/<repository-name> if omitted. Persisted β€” no need to pass --path again on future commands. Change it later with hyve git set-path.

Example:

Terminal window
# Add a production repository
hyve git add production --repo-url https://github.com/company/hyve-prod.git
# Add with username and set as current
hyve git add staging \
--repo-url https://github.com/company/hyve-staging.git \
--username myuser \
--set-current
# Clone somewhere other than the default ~/.hyve/repositories/<name>
hyve git add production \
--repo-url https://github.com/company/hyve-prod.git \
--path ~/code/hyve-prod

Output:

Adding Git repository 'production': https://github.com/company/hyve-prod.git
Testing Git repository connection...
βœ… Git repository connected successfully!
Repository 'production' added successfully!
Repository URL: https://github.com/company/hyve-prod.git
Local path: /Users/username/.hyve/repositories/production
Authentication: βœ… Global credentials configured
πŸ’‘ Tips:
- Use 'hyve git list' to see all repositories
- Use 'hyve git use <name>' to switch repositories
- Use 'hyve git credentials' to manage global Git authentication

hyve git list

List all configured Git repositories and their status.

Terminal window
hyve git list

Example:

Terminal window
hyve git list

Output:

πŸ“ Configured Git repositories (3):
production (current) ⭐
URL: https://github.com/company/hyve-prod.git
Local: /Users/username/.hyve/repositories/production
User: myuser
Added: 2024-01-15 10:30
staging
URL: https://github.com/company/hyve-staging.git
Local: /Users/username/.hyve/repositories/staging
Added: 2024-01-14 09:15
development
URL: https://github.com/company/hyve-dev.git
Local: /Users/username/.hyve/repositories/development
Added: 2024-01-13 14:45
πŸ”‘ Authentication: βœ… Global credentials configured (myuser)
πŸ”‘ Environment Fallback: βœ… HYVE_GIT_TOKEN configured

hyve git use

Switch to a different Git repository as the current active repository.

Terminal window
hyve git use [repository-name]
repository-name string required

Name of the repository to switch to

Example:

Terminal window
hyve git use staging

Output:

βœ… Switched to repository 'staging'
Repository URL: https://github.com/company/hyve-staging.git
Local path: /Users/username/.hyve/repositories/staging

hyve git status

Show current Git configuration status and test repository connection.

Terminal window
hyve git status

Example:

Terminal window
hyve git status

Output:

βœ… Current repository: production
Repository URL: https://github.com/company/hyve-prod.git
Local path: /Users/username/.hyve/repositories/production
Username: myuser
Authentication: βœ… Global credentials configured (myuser)
Testing connection...
βœ… Connection successful

hyve git path

Print a repository’s absolute local filesystem path β€” nothing else is written to stdout, so it composes with shell substitution for quickly navigating to the repo.

Terminal window
hyve git path [flags]
--repo string

Repository name. Defaults to the current repository.

Example:

Terminal window
cd "$(hyve git path)"
# A different repository
cd "$(hyve git path --repo staging)"

Output:

/Users/username/.hyve/repositories/production

hyve git set-path

Move a repository’s local clone to a new location on disk and persist it β€” no --path flag is needed on any future command, the new location is remembered.

Terminal window
hyve git set-path <new-path> [flags]
new-path string required

Where to move the repository’s local clone.

--repo string

Repository name to move. Defaults to the current repository.

Example:

Terminal window
hyve git set-path ~/code/hyve-prod
# A different repository
hyve git set-path /Volumes/external/hyve-staging --repo staging

Output:

βœ… Repository 'production' local path updated
Old: /Users/username/.hyve/repositories/production
New: /Users/username/code/hyve-prod
πŸ’‘ No --path flag needed going forward β€” this is persisted.

hyve git reset-path

Move a repository’s local clone back to the default location (~/.hyve/repositories/<name>), undoing a previous hyve git set-path.

Terminal window
hyve git reset-path [flags]
--repo string

Repository name to reset. Defaults to the current repository.

Example:

Terminal window
hyve git reset-path

hyve git remove

Remove a Git repository configuration from storage and delete its local clone from disk.

Terminal window
hyve git remove [repository-name] [flags]
repository-name string required

Name of the repository to remove

--keep-files boolean default: false

Keep the local clone on disk instead of deleting it

Example:

Terminal window
hyve git remove development

Output:

βœ… Repository 'development' removed successfully
Removed local clone at "/Users/you/.hyve/repositories/development"
Current repository is now: production

Pass --keep-files to drop the configuration without touching the clone on disk β€” useful if --path pointed the repository at a directory you manage yourself.


hyve git reset

Remove all Git repository configurations and their local clones, and revert to local state directory.

Terminal window
hyve git reset [flags]
--keep-files boolean default: false

Keep local clones on disk instead of deleting them

Example:

Terminal window
hyve git reset

Output:

βœ… All Git configurations reset
Add a Git repository to continue using Hyve: hyve git add <name> --repo-url <url>

hyve git credentials

Manage global Git credentials for authentication.

Terminal window
hyve git credentials [flags]
--username string

Git username for authentication

--password string

Git password or personal access token

--clear boolean default: false

Clear all stored credentials

Examples:

Terminal window
# Store credentials
hyve git credentials --username myuser --password ghp_xxxxxxxxxxxx
# View current credentials
hyve git credentials
# Clear credentials
hyve git credentials --clear

Output (store):

βœ… Global Git credentials stored securely
Username: myuser
Password: βœ… Stored and encrypted

Output (view):

βœ… Global Git credentials:
Username: myuser
Password: βœ… Stored and encrypted
Updated: 2024-01-15 10:30:45
πŸ’‘ Environment token also available as fallback

hyve git credentials-migrate

Migrate credentials encryption from hostname-based keys to portable keys.

Terminal window
hyve git credentials-migrate [old-hostname]
old-hostname string required

Hostname that was used when credentials were originally encrypted

Example:

Terminal window
hyve git credentials-migrate "old-macbook.local"

Output:

πŸ”„ Starting credentials encryption migration
πŸ”‘ Old hostname: old-macbook.local
βœ… Migration completed successfully!
πŸ“ Your credentials have been re-encrypted with the new portable key format.
πŸ’‘ Your credentials will now work across different machines without hostname dependencies.

Branch Management

hyve git branch list

List all branches in the current Git repository.

Terminal window
hyve git branch list

Example:

Terminal window
hyve git branch list

Output:

🌿 Branches in repository 'production':
* main (a1b2c3d)
feature/new-cluster (e4f5g6h)
hotfix/cluster-config (i7j8k9l)
πŸ’‘ Commands:
hyve git branch create <name> # Create new branch
hyve git branch switch <name> # Switch to branch
hyve git branch delete <name> # Delete branch

hyve git branch create

Create a new branch from the current HEAD.

Terminal window
hyve git branch create [branch-name] [flags]
branch-name string required

Name of the new branch to create

--switch boolean default: false

Switch to the new branch after creating it

--push boolean default: false

Push the branch to remote after creating it

Example:

Terminal window
# Create and switch to new branch
hyve git branch create feature/add-monitoring --switch
# Create, switch, and push
hyve git branch create feature/new-env --switch --push

Output:

Creating branch 'feature/add-monitoring' from 'main'...
βœ… Branch 'feature/add-monitoring' created successfully
βœ… Switched to branch 'feature/add-monitoring'

hyve git branch delete

Delete a branch from the local repository.

Terminal window
hyve git branch delete [branch-name] [flags]
branch-name string required

Name of the branch to delete

--force boolean default: false

Force delete the branch (even if unmerged)

Example:

Terminal window
hyve git branch delete feature/old-feature --force

Output:

Deleting branch 'feature/old-feature'...
βœ… Branch 'feature/old-feature' deleted successfully
πŸ’‘ The branch has been deleted locally.
πŸ’‘ To delete from remote, use: git push origin --delete feature/old-feature

hyve git branch switch

Switch to a different branch (git checkout).

Terminal window
hyve git branch switch [branch-name] [flags]
branch-name string required

Name of the branch to switch to

--pull boolean default: false

Pull latest changes after switching

Example:

Terminal window
hyve git branch switch main --pull

Output:

Switching from 'feature/add-monitoring' to 'main'...
βœ… Switched to branch 'main'
Pulling latest changes...
βœ… Pulled latest changes
πŸ’‘ Your working directory now reflects the 'main' branch
πŸ’‘ Changes made will be tracked on this branch

Synchronization

hyve git pull

Pull the latest changes from the remote repository for the current branch.

Terminal window
hyve git pull

Example:

Terminal window
hyve git pull

Output:

Pulling latest changes from 'main'...
βœ… Successfully pulled latest changes
πŸ’‘ Your local branch is now up to date with remote

hyve git push

Stage all changes, commit with a message, and push to remote.

Terminal window
hyve git push [commit-message]
commit-message string

Commit message. If not provided, a default message will be generated based on changes.

Example:

Terminal window
hyve git push "Add new production cluster configuration"

Output:

πŸ“ Changes detected: 2 files changed, 45 insertions(+)
Committing changes to 'main'...
βœ… Changes committed successfully
Pushing to remote 'main'...
βœ… Changes pushed successfully
πŸ’‘ Branch 'main' is now synchronized with remote

hyve git sync

Pull latest changes from remote and push any local changes.

Terminal window
hyve git sync [commit-message]
commit-message string

Commit message for local changes. If not provided, you’ll be prompted.

Example:

Terminal window
hyve git sync "Sync cluster configurations"

Output:

πŸ”„ Syncing branch 'main' with remote...
1. Pulling latest changes from remote...
βœ… Pulled latest changes
2. Local changes detected: 3 files changed, 67 insertions(+)
3. Committing local changes...
βœ… Changes committed
4. Pushing to remote...
βœ… Changes pushed
βœ… Branch 'main' is now fully synchronized

Authentication

Hyve supports multiple authentication methods for Git operations:

  1. Global Credentials (Recommended): Store credentials securely using hyve git credentials
  2. Environment Variable: Set HYVE_GIT_TOKEN with your personal access token
  3. Repository-specific Username: Provide username with --username flag when adding repository

Priority Order

  1. Global credentials (username + password from hyve git credentials)
  2. Environment token (HYVE_GIT_TOKEN)
  3. No authentication (for public repositories)

Storage

All Git repository metadata is stored in:

~/.hyve/
β”œβ”€β”€ repositories.db # Repository configurations (SQLite)
β”œβ”€β”€ credentials.db # Encrypted credentials (AES-GCM)
└── repositories/ # Cloned repository storage
β”œβ”€β”€ production/
β”‚ β”œβ”€β”€ clusters/
β”‚ β”œβ”€β”€ workflows/
β”‚ └── templates/
└── staging/

Common Use Cases

Multi-Environment Setup

Terminal window
# Add repositories for each environment
hyve git add production --repo-url https://github.com/company/hyve-prod.git
hyve git add staging --repo-url https://github.com/company/hyve-staging.git
hyve git add development --repo-url https://github.com/company/hyve-dev.git
# Switch between environments
hyve git use production # Work with production clusters
hyve git use staging # Switch to staging

Feature Branch Workflow

Terminal window
# Create feature branch
hyve git branch create feature/add-monitoring --switch
# Make changes to cluster configs
hyve cluster add monitoring-cluster --provider civo --region PHX1
# Commit and push changes
hyve git push "Add monitoring cluster configuration"
# Switch back to main
hyve git branch switch main

Credential Management

Terminal window
# Store credentials securely
hyve git credentials --username myuser --password ghp_xxxxxxxxxxxx
# Or use environment variable
export HYVE_GIT_TOKEN=ghp_xxxxxxxxxxxx
# Verify authentication
hyve git status