Resolving Git Executable Error in Branch Deployment Code Locations

Last updated: November 10, 2025

This article helps resolve deployment errors related to missing git executable when using branch deployment code locations in Dagster.

Problem Description

Users experience deployment failures when deploying branch-deployment code locations due to a missing or improperly configured git executable. This is a known issue that affects the dagster-dbt integration when it attempts to initialize git repositories.

Symptoms

  • DagsterImportError with message "Failed to initialize: Bad git executable"

  • Error occurs during code location deployment, specifically when importing dagster-dbt modules

  • Stack trace shows failure in git/__init__.py when trying to refresh git executable

  • Deployment worked previously but suddenly started failing without configuration changes

Root Cause

This is a known issue in Dagster where the git executable is not properly available in the deployment environment. The dagster-dbt integration requires git to be accessible, but the deployment environment may not have git installed or properly configured in the PATH.

Solution

Pin your Dagster version to avoid the problematic version until the fix is released.

Step-by-Step Resolution

  1. Identify your current Dagster version and pin to a stable version in your requirements.txt or pyproject.toml:

    dagster==1.8.x  # Replace x with the last working version
  2. Redeploy your code location with the pinned version

  3. Verify the deployment completes successfully without git executable errors

Alternative Solutions

If pinning the version doesn't work, you can try setting the GIT_PYTHON_REFRESH environment variable to suppress the error:

export GIT_PYTHON_REFRESH=quiet

Prevention

Monitor Dagster release notes for updates on this issue and upgrade to newer versions once the fix is available. Consider testing deployments in a staging environment before promoting to production.

Related Documentation