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:
Scheduling with GitHub Actions
Set up automated syncing with GitHub Actions to keep your context up to date. This runsnao sync on GitHub’s servers on a schedule, commits any changes to your context files (like updated database schemas or docs), and pushes them back so your context stays current without manual commands.
1. Create Workflow File
Create .github/workflows/nao-sync.yml in your repository:
- Go to Settings → Secrets and variables → Actions
- Click “New repository secret”
- Add secrets for all environment variables used in your
nao_config.yaml:ANTHROPIC_API_KEY- Required fornao syncto run the agentGCP_SERVICE_ACCOUNT_KEY_JSON- Full JSON content of your BigQuery service accountNOTION_API_KEY- If using Notion integration- Any other credentials referenced in your config
- Go to Actions tab in your repository
- Select “Nao Sync” workflow
- Click “Run workflow”
- Check the Actions tab to see sync history
- Review logs if sync fails
- Verify changes are committed to your repository
The workflow automatically commits and pushes any changes from
nao sync back to your repository, keeping your context files up to date.Configuration
Configure your project and run nao sync
Self-Hosting Guide
Deploy your repository to production (local Docker & Cloud Run)