Skip to main content
Convert your local nao project into a Git repository for version control, collaboration, and automated deployments.
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:
Initialize a Git repository:

Step 2: Create .gitignore

Create a .gitignore file to exclude sensitive files:
Never commit credentials or API keys to Git! Always use environment variables or secret management systems.

Step 3: Configure for Git

Update your nao_config.yaml to use environment variables instead of file paths: Before (local files):
After (environment variables):

Step 4: Add and Commit Files

Add your project files:

Step 5: Create GitHub Repository

  1. Go to GitHub and create a new repository
  2. Don’t initialize with README, .gitignore, or license (you already have these)
  3. 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:
2. Store Secrets Securely For Local Development:
  • Use .env file (in .gitignore)
  • Load with source .env or a tool like direnv
For Cloud Deployments:
  • Use secret management (Google Secret Manager, AWS Secrets Manager, etc.)
  • Store in GitHub Secrets for Actions
For GitHub Actions:
  • Go to repository Settings → Secrets and variables → Actions
  • Add secrets for all credentials used in nao_config.yaml
3. Commit Synced Context After running nao sync, commit the generated context files:
4. Use Automated Sync Set up GitHub Actions to automatically sync and commit context updates.

Deployment Integration

Cloud Run Deployment When deploying to Cloud Run:
  1. Connect your GitHub repository to Cloud Build
  2. Cloud Build automatically builds and deploys on push
  3. Use Secret Manager for credentials
  4. Environment variables are set in Cloud Run configuration
See the Self-Hosting Guide for Cloud Run deployment details. Dockerfile Create a Dockerfile in your repository:
Create a .dockerignore:
What’s Next?

Synchronization

Set up automated syncing with GitHub Actions

Self-Hosting Guide

Deploy your repository to production (local Docker & Cloud Run)