Docs/ Deployment/ Git Deploy

Git Deploy

Connect any Git repository and deploy automatically on every push. sh0 handles cloning, building, and deploying your application with zero configuration.

Connecting a Repository

To deploy from Git, navigate to your stack in the sh0 dashboard and select New AppGit Repository. You can connect a repository by entering its URL or by linking your Git provider account for private repository access.

New app creation dialog showing the Git Repository option

For public repositories, paste the HTTPS clone URL directly. For private repositories, you will need to connect your Git provider account or add an SSH key under Settings → SSH Keys.

Repository URL
https://github.com/your-org/your-app.git

Supported Providers

sh0 works with any Git provider that supports webhooks and SSH/HTTPS cloning:

  • GitHub -- OAuth integration for one-click repository linking
  • GitLab -- Self-hosted and GitLab.com supported
  • Bitbucket -- Cloud and Server editions
  • Gitea / Forgejo -- Self-hosted Git forges
  • Any Git server -- Any repository accessible via SSH or HTTPS
Git provider selection screen with GitHub, GitLab, and Bitbucket options
Tip
Connecting your GitHub account via OAuth lets sh0 list your repositories, set up webhooks automatically, and report build status back to your pull requests.

Webhook Configuration

Webhooks enable push-to-deploy. When you push code to your repository, your Git provider sends a notification to sh0, which triggers a new build and deployment.

If you connected your Git provider via OAuth, webhooks are configured automatically. For manual setup, add a webhook in your repository settings with the following URL:

Webhook URL
https://your-sh0-server.com:9000/api/hooks/git/{app_id}

Configure the webhook to trigger on push events. sh0 generates a webhook secret for each app, which you can find under App Settings → Git → Webhook Secret. Add this secret to your Git provider to verify incoming payloads.

Webhook configuration panel showing the webhook URL and secret
Note
sh0 validates webhook signatures using HMAC-SHA256. This ensures that only genuine pushes from your repository trigger deployments.

Branch Selection

By default, sh0 deploys from the main branch. You can change the deploy branch in your app settings to deploy from any branch in your repository.

Branch selection dropdown in app Git settings

Common configurations include:

  • Production: Deploy from main or production
  • Staging: Deploy from develop or staging
  • Feature branches: Use Preview Environments for automatic PR deployments

Build Settings

sh0 automatically detects your application stack and configures the build pipeline accordingly. You can also override these settings manually.

Dockerfile Auto-Detection

If your repository contains a Dockerfile, sh0 uses it automatically. You can also specify a custom Dockerfile path and build context:

Build configuration
dockerfile: ./deploy/Dockerfile
context: .
build_args:
  NODE_ENV: production
  API_URL: https://api.example.com

sh0 supports multi-stage builds, build arguments, and custom build contexts. The build runs on your server, so large images do not incur transfer costs.

Buildpacks

If your repository does not include a Dockerfile, sh0 analyzes your code and generates an optimized Dockerfile automatically. It detects over 15 frameworks and languages:

  • Node.js: Next.js, Nuxt, SvelteKit, Remix, Express, Fastify
  • Python: Django, Flask, FastAPI
  • Go: Standard Go modules
  • Rust: Cargo-based projects
  • PHP: Laravel, Symfony
  • Ruby: Rails, Sinatra
  • Static sites: HTML, Astro, Hugo, Jekyll
Auto-detected build settings showing Node.js with Next.js framework
Tip
You can override the auto-detected settings at any time. Navigate to App Settings → Build to customize the Dockerfile, build command, or install command.

Deploy on Push

With webhooks configured, every push to your deploy branch automatically triggers a new deployment. The workflow is:

  1. You push code to the configured branch
  2. Your Git provider sends a webhook to sh0
  3. sh0 pulls the latest code from your repository
  4. The Docker image is built from your Dockerfile (or auto-generated one)
  5. A new container is deployed using blue-green deployment
  6. Traffic is switched to the new container once health checks pass

You can also disable automatic deploys and trigger them manually from the dashboard or via the API:

Trigger deploy via API
curl -X POST https://your-sh0-server.com:9000/api/apps/{app_id}/deploy \
  -H "Authorization: Bearer YOUR_TOKEN"

Viewing Build Logs

Every deployment generates a full build log that you can stream in real time from the dashboard. Build logs include:

  • Git clone and checkout output
  • Docker image build steps (each layer)
  • Container startup and health check results
  • Traffic switch confirmation
Real-time build log streaming in the sh0 dashboard

Build logs are stored for every deployment and can be accessed from the Deployments tab at any time. If a build fails, sh0 keeps the previous version running and marks the deployment as failed with a detailed error message.

Warning
If your build fails repeatedly, check the Build Logs for missing dependencies or incorrect build commands. You can also SSH into a debug container using Terminal Access to troubleshoot.