Once your context lives in a GitHub repository, you can also connect it to nao chat so context admins can edit context files and open pull requests from the browser. See Git.
Why Use Git?
Using Git for your nao project provides:- Version Control: Track changes to your context files
- Collaboration: Multiple team members can contribute
- Automated Sync: Use GitHub Actions to automatically sync context
- Deployment: Easy integration with cloud deployments (Cloud Run, etc.)
- Backup: Your context is safely stored in the cloud
Initial Setup
Step 1: Initialize Git Repository
Navigate to your nao project directory:Step 2: Create .gitignore
Create a.gitignore file to exclude sensitive files:
Step 3: Configure for Git
Update yournao_config.yaml to use environment variables instead of file paths:
Before (local files):
Step 4: Add and Commit Files
Add your project files:Step 5: Create GitHub Repository
- Go to GitHub and create a new repository
- Don’t initialize with README, .gitignore, or license (you already have these)
- Copy the repository URL
Step 6: Connect to GitHub
Add the remote and push:Best Practices
1. Use Environment Variables Always use environment variables for secrets:- Use
.envfile (in.gitignore) - Load with
source .envor a tool likedirenv
- Use secret management (Google Secret Manager, AWS Secrets Manager, etc.)
- Store in GitHub Secrets for Actions
- Go to repository Settings → Secrets and variables → Actions
- Add secrets for all credentials used in
nao_config.yaml
nao sync, commit the generated context files:
Deployment Integration
Cloud Run Deployment When deploying to Cloud Run:- Connect your GitHub repository to Cloud Build
- Cloud Build automatically builds and deploys on push
- Use Secret Manager for credentials
- Environment variables are set in Cloud Run configuration
Dockerfile in your repository:
.dockerignore:
Synchronization
Set up automated syncing with GitHub Actions
Self-Hosting Guide
Deploy your repository to production (local Docker & Cloud Run)