Basic Tutorial: Environment Setup and Tool Installation
After completing this chapter, you will be able to:
- ✅ Successfully register required development accounts
- ✅ Install and configure Gemini CLI locally
- ✅ Use AI to manage your development environment
- ✅ Master basic AI-assisted development workflows
📹 Course Video
Watch the complete teaching video for Lessons 1 and 2:
📋 Required Account Registration
Before we start using Gemini CLI, we need to prepare three important accounts. These accounts will be used throughout the entire development process.
- GitHub Account
- Vercel Account
- Google Account
Why Do You Need GitHub?
GitHub is the world's largest code hosting platform. We'll use it to:
- Store and manage code
- Collaborate with others on development
- Showcase personal project portfolio
Registration Steps
- Visit GitHub.com
- Click "Sign up" in the top right corner
- Fill in registration information:
- Username: Choose a professional username (recommended to use real name or nickname)
- Email: Use your regular email address
- Password: Set a strong password
Choose your username carefully, as it will appear in all your project URLs. Recommended:
- Real name:
john-smith - Professional nickname:
webdev-pro - Avoid ending with numbers:
coder123
Initial Configuration
After registration, it's recommended to complete the following configuration:
# Configure Git global user information
git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"
Why Choose Vercel?
Vercel is a modern deployment platform, particularly suitable for:
- One-click deployment of frontend projects
- Automated CI/CD workflows
- Free HTTPS and global CDN
Registration Process
- Visit Vercel.com
- Click "Sign Up"
- Recommended: Choose "Continue with GitHub" to log in with your GitHub account
- Authorize Vercel to access your GitHub repositories
Advantage Features
🚀 Lightning-Fast Deployment
Automatic deployment after code push, takes effect in seconds
🌍 Global Acceleration
Built-in CDN allows your website to be accessed quickly worldwide
📊 Analytics Dashboard
Real-time monitoring of website performance and visitor data
Importance of Google Account
A Google account is a core requirement for using Gemini CLI:
- Log in to Gemini CLI
- Access Google's AI services
- Sync configurations and preferences
Create Account
- Visit accounts.google.com
- Click "Create account"
- Select "For personal use"
- Fill in basic information
Be sure to:
- Enable two-factor authentication
- Use a strong password
- Regularly check account activity
🛠️ Gemini CLI Installation and Configuration
System Requirements
- Windows
- macOS
- Linux
Minimum Requirements:
- Windows 10 version 1903 or higher
- Node.js 16.0 or higher
- 4GB RAM (8GB recommended)
Recommended Configuration:
- Windows 11
- Node.js 18.x LTS
- Use Windows Terminal
Minimum Requirements:
- macOS 10.15 (Catalina) or higher
- Node.js 16.0 or higher
- 4GB RAM
Recommended Configuration:
- macOS 12.0 (Monterey) or higher
- Node.js 18.x LTS
- Use iTerm2 or native Terminal
Supported Distributions:
- Ubuntu 20.04 LTS or higher
- Debian 10 or higher
- Fedora 34 or higher
- Other mainstream distributions
Dependencies:
- Node.js 16.0 or higher
- npm or yarn
Installation Steps
Step 1: Check Node.js Version
# Check if Node.js is installed
node --version
# If not installed or version is too low, visit nodejs.org to download and install
Step 2: Install Gemini CLI Globally
# Install using npm (recommended)
npm install -g @google/gemini-cli
# Or use yarn
yarn global add @google/gemini-cli
# Or use pnpm
pnpm add -g @google/gemini-cli
If you encounter permission issues:
- Windows: Run command prompt as administrator
- macOS/Linux: Use
sudo npm install -g @google/gemini-cli
Step 3: Verify Installation
# Check if installation was successful
gemini --version
# View available commands
gemini --help
Initial Configuration
After installation, you need to perform initial configuration:
# 1. Log in to your Google account
gemini auth login
# 2. The system will open a browser, please log in to your Google account
# 3. Authorize Gemini CLI to access necessary permissions
# 4. Return to the terminal, you should see "Successfully authenticated!" message
Configuration Options
- Basic Configuration
- Advanced Configuration
# Set default project path
gemini config set default-path ~/projects
# Set language preference
gemini config set language en-US
# View current configuration
gemini config list
# Set API timeout (milliseconds)
gemini config set timeout 30000
# Enable debug mode
gemini config set debug true
# Set proxy (if needed)
gemini config set proxy http://proxy.example.com:8080
# Export configuration file
gemini config export > gemini-config.json
🎮 Basic Usage Examples
Your First Conversation
Now let's start using Gemini CLI!
# Start interactive conversation
gemini chat
# Gemini will respond:
# "Hello! I'm Gemini, your AI programming assistant. How can I help you?"
Practical Conversation Examples
🔧 Environment Configuration
You: Hello, I want to develop a web application. What development environment do I need to install?
Gemini: I'll help you configure a web development environment. I recommend installing the following tools:
1. Node.js and npm - JavaScript runtime environment
2. VS Code - Code editor
3. Git - Version control
4. Chrome DevTools - Debugging tools
Would you like me to help you automatically install these tools?
📦 Dependency Management
You: Please help me check what Node.js global packages I have locally, and suggest which ones can be removed
Gemini: Scanning your global npm packages...
Found the following packages:
- create-react-app (v4.0.3) - Recommend removal, use npx instead
- nodemon (v2.0.15) - Keep, commonly used for development
- typescript (v4.5.2) - Recommend removal, better to install at project level
- pm2 (v5.1.0) - Keep, process management tool
Would you like me to help clean up these packages?
🛤️ PATH Management
You: Help me view and organize the system PATH
Gemini: Detected the following entries in your PATH:
Duplicates:
- /usr/local/bin (appears 3 times)
- ~/.npm-global/bin (appears 2 times)
Invalid paths:
- /opt/old-software/bin (does not exist)
Recommended optimized PATH order:
1. ~/.local/bin
2. /usr/local/bin
3. ~/.npm-global/bin
4. /usr/bin
Would you like to apply these changes?
🚫 Say Goodbye to Traditional Cumbersome Methods
Tools No Longer Needed
| Traditional Tool | Why Replaced by Gemini CLI |
|---|---|
| Cursor | • Blocked in mainland China • Low cost-effectiveness of Pro quota • Gemini CLI is completely free to use |
| GitHub Desktop | • No need for GUI tools • Gemini can execute all Git operations • More flexible command-line interaction |
| Git Commands | • No need to memorize any Git commands • Natural language description is enough • AI automatically handles complex operations |
Old vs New Comparison
- ❌ Traditional Way
- ✅ Gemini CLI Way
# Commands to memorize and type
git add .
git commit -m "feat: add new feature"
git push origin main
# Resolve conflicts
git fetch origin
git merge origin/main
# Manually resolve conflicts...
git add .
git commit
git push
# View history
git log --oneline --graph --all
You: Commit my changes, description is "added new feature"
Gemini: Sure, I'll commit your changes...
[Executing git add, commit, push]
✓ Successfully committed to main branch
You: There's a conflict, help me resolve it
Gemini: Merge conflict detected, I'll help you:
1. Analyzing conflict files...
2. Suggesting resolution based on code logic...
3. Would you like to accept my suggestion?
You: View recent commit history
Gemini: Last 5 commits:
• 2 minutes ago: Added new feature (You)
• 1 hour ago: Fixed login issue (Zhang San)
• 3 hours ago: Updated documentation (Li Si)
...
💡 Best Practice Recommendations
Daily Workflow
-
Start of Day
You: Good morning, help me check the project status
Gemini: Checking your project status... -
Development Process
You: I want to start developing user authentication feature
Gemini: I'll help you prepare... -
Problem Solving
You: npm install is showing an error, help me check it
Gemini: I'll analyze the error...
Efficiency Improvement Tips
🎯 Clear Expression
Clearly describe your needs, AI will help you more accurately
🔄 Continuous Conversation
Maintain context, letting AI better understand your project
📝 Use History Well
Use gemini history to view previous conversations
🎯 Next Steps
Congratulations on completing the basic environment configuration! Now you have:
- ✅ Three necessary development accounts
- ✅ Locally installed Gemini CLI
- ✅ Basic knowledge of AI-assisted development