Using and Configuring GIT_ASKPASS in VS Code
Last updated: June 25, 2026
Overview: This article explains why GIT_ASKPASS values change when using code-server in Coder workspaces and how to configure it correctly for seamless Git authentication.
What is GIT_ASKPASS?
GIT_ASKPASS is an environment variable that tells Git which program to use for credential prompts. In Coder workspaces, this is crucial for automatic Git authentication without manual login prompts.
Two Different Values Explained
GIT_ASKPASS Value | Set By | Behavior |
|---|---|---|
| Coder Agent | ✅ Automatic Git authentication using Coder's external auth (GitHub, GitLab, etc.) |
| code-server / VS Code | ❌ Requires interactive login through VS Code UI (won't work during workspace startup) |
Why Does This Happen?
Root Cause: VS Code and code-server override the GIT_ASKPASS environment variable to use their integrated Git authentication UI. This behavior is documented in the Coder source code.
When Does the Override Occur?
Using code-server module: code-server starts during Terraform provisioning. Since
GIT_ASKPASSisn't set yet, code-server defaults to its own script.Manual code-server startup: When code-server starts in
startup_script, it may inconsistently inherit the variable.
Solution: Disable VS Code Git Authentication
✅ Recommended Solution: Configure code-server to disable its integrated Git authentication. This forces it to use Coder's Git auth instead.
1 : Using the code-server Module (Recommended)
The cleanest solution is to configure the module's machine settings:
module "code-server" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/modules/code-server/coder"
agent_id = coder_agent.main.id
# Disable VS Code's integrated Git authentication
machine_settings = {
"git.useIntegratedAskPass" = false
"github.gitAuthentication" = false
}
}Why this works: Setting machine_settings creates the configuration file before code-server starts, ensuring it never attempts to override GIT_ASKPASS.
2 : Manual Configuration via Startup Script
If you aren't using the module, write the settings file manually in your startup_script:
Basic Approach (Overwrites existing settings)
resource "coder_agent" "main" {
startup_script = <<-EOT
#!/bin/bash
set -e
# Create code-server config directory
mkdir -p ~/.local/share/code-server/User
# Write settings to disable integrated Git auth
cat > ~/.local/share/code-server/User/settings.json <<'EOF'
{
"git.useIntegratedAskPass": false,
"github.gitAuthentication": false
}
EOF
# Start code-server
code-server --auth none --port 13337 > /tmp/code-server.log 2>&1 &
EOT
}3 : Alternative: VS Code Remote SSH
If you use the VS Code Remote SSH extension instead of browser-based code-server, this issue does not occur. Remote SSH correctly respects the variables set by Coder.
Verification Steps
Check Environment Variables: Run
echo $GIT_ASKPASSin the code-server terminal. It should show/tmp/coder.XXXXX/coder.Test Git: Run
git clone .... It should proceed without prompting for a username/password.Check Settings: Open code-server Settings and search for "Integrated Ask Pass". It should be unchecked.
Summary
Method | Pros | Cons |
|---|---|---|
VS Code Remote SSH | ✅ No config needed | Requires SSH access |
Startup script | ✅ Flexible | ❌ Timing-sensitive |
Last updated: November 2025 | Applies to: Coder v2.14+