Migration Guide
Upgrade from older versions to the latest Gemini CLI
Migration Overview
This guide helps you migrate from older versions of Gemini CLI to the latest version. We'll cover breaking changes, configuration updates, and provide step-by-step instructions for a smooth transition.
Version Compatibility Matrix
Check which migration path applies to your current version
Breaking Changes in v2.0.0
Important changes that may affect your existing setup
Configuration File Format
The configuration file format has changed from JSON to YAML for better readability and comments support.
Before (v1.x)
{
"api_key": "your-key",
"model": "gemini-pro"
}
After (v2.0)
api_key: your-key
model: gemini-pro
# Comments are now supported!
Command Structure Changes
Some commands have been renamed or restructured for consistency.
Command Changes
gemini chat
gemini ask
gemini generate
gemini create
gemini config show
gemini config list
API Key Management
API keys are now stored in a more secure format with encryption.
Your existing API key will be automatically migrated on first run
Step-by-Step Migration
Follow these steps to migrate to Gemini CLI v2.0.0
Backup Your Configuration
Create a backup of your current configuration before starting the migration.
Commands:
gemini config list > gemini-config-backup.txt
cp ~/.gemini/config.json ~/.gemini/config.json.backup
This ensures you can restore your settings if needed.
Update Gemini CLI
Install the latest version of Gemini CLI.
Commands:
npm update -g @google/generative-ai-cli
Verification:
gemini --version
Run Migration Tool
Use the built-in migration tool to update your configuration.
Commands:
gemini config migrate
This will automatically convert your configuration to the new format.
Verify Configuration
Check that your configuration has been migrated correctly.
Commands:
gemini config list
gemini ask "Hello, testing migration"
Ensure all your settings are preserved and the CLI works as expected.
Update Scripts and Aliases
Update any scripts or aliases that use the old command syntax.
Refer to the command changes section above for specific updates needed.
Migration Troubleshooting
Common issues and their solutions
Configuration migration failed
Symptoms:
- Error: Unable to migrate configuration
- Config file not found
Solutions:
- Ensure you have write permissions to the ~/.gemini directory
- Check if the old config file exists: ls ~/.gemini/
- Try manual migration: gemini config migrate --force
Commands not working after migration
Symptoms:
- Command not found errors
- Unexpected behavior
Solutions:
- Clear your shell cache: hash -r
- Restart your terminal session
- Check the new command syntax in the documentation
API key not working
Symptoms:
- Authentication errors
- Invalid API key messages
Solutions:
- Re-set your API key: gemini config set api-key YOUR_KEY
- Verify the key is correct: gemini config get api-key
- Check API key permissions in Google AI Studio
Rollback Instructions
How to revert to the previous version if needed
β οΈ Only use rollback if you encounter critical issues that prevent normal operation.
- 1
Uninstall current version: npm uninstall -g @google/generative-ai-cli
- 2
Install previous version: npm install -g @google/generative-ai-cli@1.9.0
- 3
Restore configuration: cp ~/.gemini/config.json.backup ~/.gemini/config.json
- 4
Verify rollback: gemini --version
Post-Migration Steps
Recommended actions after successful migration
Update Documentation
MediumUpdate any internal documentation or team guides to reflect the new command syntax.
Test Automation Scripts
HighRun your automated scripts and CI/CD pipelines to ensure they work with the new version.
Clean Up Backups
LowAfter confirming everything works, you can remove the backup files.
Need Help with Migration?
If you encounter any issues during migration, our community is here to help.