Skip to content

Commit df6e026

Browse files
fix: remove vscode user references from coder startup script (#437)
- Changed ownership and git config commands to run as root - All container paths now consistently use /root/ instead of /home/vscode/ - Fixes 'dubious ownership' git errors in workspace startup Co-authored-by: Mohsin Hashmi <mhashmi@wiser.com>
1 parent badec47 commit df6e026

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

.coder/template.tf

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,10 @@ resource "coder_agent" "main" {
156156
157157
echo "🚀 Starting SimpleAccounts-UAE workspace..."
158158
159-
# Fix workspace directory ownership for vscode user (runs as root first)
160-
# This ensures npm, git, and IDE tools work correctly
161-
echo "🔧 Fixing workspace permissions..."
159+
# Configure git to trust workspace directory (prevents dubious ownership warning)
160+
echo "🔧 Configuring git safe directory..."
162161
if [ -d /workspaces/SimpleAccounts-UAE ]; then
163-
chown -R vscode:vscode /workspaces/SimpleAccounts-UAE 2>/dev/null || true
164-
# Configure git to trust this directory (prevents dubious ownership warning)
165-
su vscode -c "git config --global --add safe.directory /workspaces/SimpleAccounts-UAE" 2>/dev/null || true
162+
git config --global --add safe.directory /workspaces/SimpleAccounts-UAE 2>/dev/null || true
166163
fi
167164
168165
# Wait for PostgreSQL
@@ -180,7 +177,6 @@ resource "coder_agent" "main" {
180177
echo "📦 Cloning repository..."
181178
git clone ${data.coder_parameter.git_clone_url.value} /workspaces/SimpleAccounts-UAE || echo "⚠️ Clone failed, may already exist"
182179
cd /workspaces/SimpleAccounts-UAE
183-
chown -R vscode:vscode /workspaces/SimpleAccounts-UAE 2>/dev/null || true
184180
else
185181
echo "✅ Repository already cloned"
186182
cd /workspaces/SimpleAccounts-UAE
@@ -307,17 +303,17 @@ resource "docker_container" "workspace" {
307303
# Cache volumes (rebuilds are OK)
308304
volumes {
309305
volume_name = docker_volume.vscode_extensions.name
310-
container_path = "/home/vscode/.vscode-server/extensions"
306+
container_path = "/root/.vscode-server/extensions"
311307
}
312308

313309
volumes {
314310
volume_name = docker_volume.maven_cache.name
315-
container_path = "/home/vscode/.m2"
311+
container_path = "/root/.m2"
316312
}
317313

318314
volumes {
319315
volume_name = docker_volume.npm_cache.name
320-
container_path = "/home/vscode/.npm"
316+
container_path = "/root/.npm"
321317
}
322318

323319
# User credentials (persistent across host)

0 commit comments

Comments
 (0)