This is Part 3 of our series on AI coding assistants for developers. See also: Getting Started with Claude Code, Getting Started with OpenAI Codex CLI, and Comparing Claude Code, Codex, and Gemini CLI.
Google has entered the AI coding assistant arena with Gemini CLI, an open-source agent that brings the power of Gemini models directly to your terminal. What sets Gemini CLI apart is its combination of generous free usage limits, deep integration with the Google developer ecosystem, and its fully open-source nature.
For developers who value transparency, cost-effectiveness, and tight integration with Google Cloud services, Gemini CLI offers a compelling option. Let's explore how to set it up and leverage it for deployment workflows.
What is Gemini CLI?
Gemini CLI is an open-source AI agent (licensed under Apache 2.0) that provides access to Gemini models directly in your terminal. It uses a ReAct (Reason and Act) loop with built-in tools and MCP server support to handle complex tasks like fixing bugs, creating features, and improving test coverage.
While it excels at coding, Gemini CLI is designed to be versatile—handling everything from content generation and problem-solving to research and task management.
Key highlights include:
- Powerful Gemini Models: Access to Gemini 2.5 Pro (with Gemini 3 Pro for premium users), including the massive 1M token context window
- Built-in Tools: Google Search grounding, file operations, shell commands, and web fetching
- Fully Open Source: Inspect the code, understand how it works, and contribute to its development
- Generous Free Tier: 60 requests per minute and 1,000 requests per day at no charge
Installation and Setup
Gemini CLI can be installed via npm and is also available without additional setup in Google Cloud Shell.
Installing with npm
npm install -g @anthropic-ai/gemini-cli
Or use the preview tag for the latest features:
npm install -g @anthropic-ai/gemini-cli@preview
Running in Cloud Shell
If you're already using Google Cloud, Gemini CLI is available immediately in Cloud Shell without any installation required.
Authentication Options
Gemini CLI offers several authentication methods depending on your use case:
Personal Google Account (Free): The simplest option—authenticate with your personal Google account to access Gemini 2.5 Pro with the industry's most generous free usage limits.
gemini
# Follow the OAuth prompts to authenticate
Google AI Studio API Key: For more control or specific model access:
export GOOGLE_API_KEY="your-api-key-here"
gemini
Vertex AI: For enterprise users or those wanting to use Google Cloud infrastructure:
export GOOGLE_API_KEY="your-vertex-ai-key"
export GOOGLE_GENAI_USE_VERTEXAI=true
gemini
Gemini Code Assist License: If you have a Gemini Code Assist Standard or Enterprise license, your usage is shared between the IDE extension and CLI.
Getting Started
Navigate to your project directory and launch:
cd your-project/
gemini
You'll enter an interactive session where you can describe tasks in natural language. For non-interactive use:
gemini -p "Explain the architecture of this codebase"
Understanding the Free Tier Limits
One of Gemini CLI's most attractive features is its free tier:
- 60 model requests per minute
- 1,000 model requests per day
This is significantly more generous than competing tools and sufficient for most individual developers' daily needs. If you need more, you can use a Google AI Studio API key for usage-based billing or upgrade to Gemini Code Assist Standard or Enterprise.
Built-in Tools and Capabilities
Gemini CLI comes with powerful built-in tools that make it particularly effective for development and deployment workflows.
Google Search Grounding
Gemini CLI can ground its responses with real-time information from Google Search:
> What are the latest security patches for Rails 7.1?
Check the Rails security announcements.
This is invaluable for deployment tasks where you need current information about dependencies, security vulnerabilities, or best practices.
File Operations and Shell Commands
The CLI can read files, write files, and execute shell commands:
> Read the Gemfile.lock and identify any gems with known security vulnerabilities.
Then create a script to update them safely.
Web Fetching
Need information from documentation or external sources?
> Fetch the DeployHQ API documentation and write a script that
triggers a deployment via their API.
Practical Examples for Deployment Workflows
Let's explore deployment-focused scenarios where Gemini CLI shines.
Creating Deployment Configurations with Current Best Practices
The Google Search grounding feature is particularly useful when you need up-to-date configurations:
> Create a deployment configuration for this Rails 8 app.
Search for the latest Rails 8 deployment best practices and
incorporate them into the configuration.
Building Deployment Status Dashboards
Gemini CLI can generate complete, runnable projects:
> Create a simple web dashboard that:
- Fetches deployment status from our CI/CD API
- Shows the last 10 deployments with their status
- Highlights any failed deployments
- Auto-refreshes every 30 seconds
Generating Comprehensive Test Suites for Deployment Scripts
Before deploying, ensure your scripts are well-tested:
> Look at our deploy.rb script and write comprehensive tests for it.
Include tests for:
- Successful deployment scenarios
- Failure handling and rollback
- Environment-specific configurations
Infrastructure as Code Generation
For cloud deployments:
> Generate Terraform configuration to provision:
- An EC2 instance with our standard deployment configuration
- An RDS PostgreSQL database
- Security groups allowing SSH and HTTP/HTTPS
- Search for current AWS best practices for security group configuration
Debugging Deployment Issues with Search Context
When something goes wrong:
> The deployment failed with this Capistrano error: [paste error]
Search for known issues with this error and suggest solutions.
Automating Documentation
Keep your deployment documentation current:
> Review our deployment scripts and configuration files.
Generate a DEPLOYMENT.md file that documents:
- Prerequisites
- Step-by-step deployment process
- Rollback procedures
- Troubleshooting common issues
Configuring Gemini CLI
Project Configuration with GEMINI.md
Create a GEMINI.md file in your project root to provide persistent context:
# Project Configuration for Gemini
## About This Project
This is a Ruby on Rails e-commerce application deployed via DeployHQ.
## Deployment Environment
- **Staging**: Ubuntu 22.04, Puma, PostgreSQL
- **Production**: Same stack, behind Nginx load balancer
## Deployment Process
1. Code is pushed to GitHub
2. DeployHQ detects the push and triggers deployment
3. Pre-deployment: Asset compilation, database backup
4. Deployment: Code sync, bundle install, migrations
5. Post-deployment: Restart application, warm caches
## Important Notes
- Always run staging deployment before production
- Database migrations require maintenance window
- Asset compilation happens on the server
Personal and Team Settings
Configure global settings in ~/.gemini/settings.json:
{
"model": "gemini-2.5-pro",
"mcp_servers": {
"github": {
"command": "npx @modelcontextprotocol/server-github"
}
},
"trusted_folders": [
"~/projects",
"~/work"
]
}
MCP Server Integration
Gemini CLI supports the Model Context Protocol for extending its capabilities:
# Configure in your settings or use directly
> @github List my open pull requests that are waiting for review
> @slack Send a message to #deployments about the upcoming release
> @database Run a query to check for pending migrations
Add MCP server configurations to your settings file to enable these integrations.
IDE Integration with Gemini Code Assist
Gemini CLI shares its engine with Gemini Code Assist, Google's IDE extension. This means:
- VS Code Integration: Agent mode in VS Code is powered by Gemini CLI
- JetBrains Support: IntelliJ and other JetBrains IDEs also have support
- Shared Quotas: If you have a Gemini Code Assist license, quotas are shared between CLI and IDE
This is particularly useful for developers who want a consistent experience across terminal and editor.
Structured Output for Automation
For scripting and CI/CD integration, Gemini CLI supports structured JSON output:
# Get JSON output for parsing in scripts
gemini -p "List the dependencies in package.json with their versions" --output-format json
# Stream JSON events for real-time monitoring
gemini -p "Run tests and deploy to staging" --output-format stream-json
This makes it easy to integrate Gemini CLI into existing automation pipelines.
Security and Privacy
Since Gemini CLI is fully open source, you can:
- Inspect exactly how it handles your code and data
- Verify its security implications
- Contribute security improvements
- Run it in environments where you need code transparency
For enterprise users, Gemini Code Assist Standard and Enterprise offer additional data protection and privacy practices.
Sandboxing and Trusted Folders
Gemini CLI includes sandboxing features for safe execution:
- Configure trusted folders where the CLI can execute commands
- Set up execution policies by folder
- Control what actions require explicit approval
This is particularly important for deployment workflows where you want to prevent accidental changes to production configurations.
Pricing and Access
Free Tier: 1,000 requests/day, 60 requests/minute—included with any personal Google account
Google AI Pro/Ultra: Higher limits across Gemini CLI and Code Assist
Gemini Code Assist Standard: $299/year through Google Developer Program, includes higher quotas and enterprise features
Gemini Code Assist Enterprise: $75/developer/month for organisations, includes customisation based on private repositories
What's Next
Gemini CLI represents Google's commitment to meeting developers where they work. Its combination of generous free tier, open-source transparency, and deep integration with Google services makes it a strong contender for teams already in the Google ecosystem.
In our final post, we'll compare Claude Code, OpenAI Codex CLI, and Gemini CLI head-to-head, helping you decide which tool best fits your deployment workflow needs.
Want to simplify your deployment process? DeployHQ automates code deployments from Git to your servers, integrating seamlessly with your existing workflow—no complex configuration required.