2.5 KiB
Environment Setup Guide
This guide helps you set up your development environment correctly to avoid warnings about missing GitHub CLI and OpenAI API keys.
GitHub CLI
GitHub CLI has been added to the Dockerfile and will be automatically installed when your container is built. If you're seeing warnings about GitHub CLI missing, you may need to:
-
Rebuild your container by running the command in VS Code:
- Press
F1
and search for "Rebuild Container" - Or select "Dev Containers: Rebuild Container" from the command palette
- Press
-
After rebuilding, authenticate with GitHub:
gh auth login
OpenAI API Key
To permanently set up your OpenAI API key (required for Smart-Fill functionality):
Option 1: GitHub Codespace Secrets (Recommended)
- Go to GitHub Codespace Secrets
- Click on "New secret"
- Name:
OPENAI_API_KEY
- Value: Your OpenAI API key
- Select the repositories where this secret should be available
- Click "Add secret"
- Rebuild your codespace for the changes to take effect
Option 2: Environment Variable in .bashrc
Add the following to your .bashrc
file in the container:
export OPENAI_API_KEY="your-openai-api-key"
Option 3: Local .env File
- Uncomment the
runArgs
section in the.devcontainer/devcontainer.json
file - Create a
.env
file in the root of your repository with:OPENAI_API_KEY=your-openai-api-key
- Add
.env
to your.gitignore
to prevent accidentally committing your API key - Rebuild your container
Environment Variables
Setting up .env file
The development environment requires a .env
file in the root directory of the repository. This file is not included in Git (it's gitignored) because it may contain sensitive information.
Before starting a codespace:
- Create a
.env
file in the root directory - The file can be empty if you don't need any environment variables
- If you need to use OpenAI API features, add your key like this:
OPENAI_API_KEY=your_api_key_here
Note: Without a .env
file (even an empty one), the codespace environment will fail to start.
Verifying Your Setup
After completing these steps, you can verify your setup by running:
# Check GitHub CLI
gh --version
# Verify OpenAI API key is set
echo $OPENAI_API_KEY | grep -o "sk-..."
If properly configured, you should no longer see warnings about missing GitHub CLI or OpenAI API key when starting your environment.