Antigravity IDE fails to initialize - git credentials file missing #28

Closed
opened 2026-02-21 17:19:33 +00:00 by cpfarhood · 1 comment
cpfarhood commented 2026-02-21 17:19:33 +00:00 (Migrated from github.com)

Problem

When using the antigravity IDE mode, the container fails to initialize the repository with the following error:

/usr/local/bin/init-repo: line 28: /config/userdata/.git-credentials: No such file or directory

This causes the container to enter a restart loop, preventing the IDE from starting.

Root Cause

The init-repo script tries to write git credentials to /config/userdata/.git-credentials but:

  1. The /config/userdata directory doesn't exist or has incorrect permissions
  2. The directory is owned by app:app but the script tries to write as root initially

Current Workaround

Manually create the directory and file with correct permissions:

kubectl exec devcontainer-homeassistant-<pod> -n cpfarhood -c devcontainer -- bash -c \
  "chown app:app /config/userdata && \
   chmod 755 /config/userdata && \
   echo 'https://oauth2:\${GITHUB_TOKEN}@github.com' > /config/userdata/.git-credentials && \
   chown app:app /config/userdata/.git-credentials && \
   chmod 600 /config/userdata/.git-credentials"

Proposed Solution

Option 1: Init Container

Add an init container to the Helm chart that sets up the directory structure:

initContainers:
  - name: setup-userdata
    image: busybox
    command: ['sh', '-c']
    args:
      - |
        mkdir -p /config/userdata
        chown 1000:1000 /config/userdata
        chmod 755 /config/userdata
        if [ -n "${GITHUB_TOKEN}" ]; then
          echo "https://oauth2:${GITHUB_TOKEN}@github.com" > /config/userdata/.git-credentials
          chown 1000:1000 /config/userdata/.git-credentials
          chmod 600 /config/userdata/.git-credentials
        fi
    volumeMounts:
      - name: userhome
        mountPath: /config
    env:
      - name: GITHUB_TOKEN
        valueFrom:
          secretKeyRef:
            name: $(SECRET_NAME)
            key: GITHUB_TOKEN
            optional: true

Option 2: Fix init-repo Script

Modify the init-repo script to:

  1. Create the directory if it doesn't exist
  2. Handle permission errors gracefully
  3. Use appropriate user context

Environment Details

  • Devcontainer Helm chart v0.2.2
  • IDE: antigravity
  • Container user: root (uid=0) with app group (gid=1000)
  • Volume mount: /config (persistent volume)

Related Context

  • Kubernetes deployment: cpfarhood/kubernetes repository
  • The issue occurs when ide: antigravity is set in the Helm values
## Problem When using the `antigravity` IDE mode, the container fails to initialize the repository with the following error: ``` /usr/local/bin/init-repo: line 28: /config/userdata/.git-credentials: No such file or directory ``` This causes the container to enter a restart loop, preventing the IDE from starting. ## Root Cause The init-repo script tries to write git credentials to `/config/userdata/.git-credentials` but: 1. The `/config/userdata` directory doesn't exist or has incorrect permissions 2. The directory is owned by `app:app` but the script tries to write as root initially ## Current Workaround Manually create the directory and file with correct permissions: ```bash kubectl exec devcontainer-homeassistant-<pod> -n cpfarhood -c devcontainer -- bash -c \ "chown app:app /config/userdata && \ chmod 755 /config/userdata && \ echo 'https://oauth2:\${GITHUB_TOKEN}@github.com' > /config/userdata/.git-credentials && \ chown app:app /config/userdata/.git-credentials && \ chmod 600 /config/userdata/.git-credentials" ``` ## Proposed Solution ### Option 1: Init Container Add an init container to the Helm chart that sets up the directory structure: ```yaml initContainers: - name: setup-userdata image: busybox command: ['sh', '-c'] args: - | mkdir -p /config/userdata chown 1000:1000 /config/userdata chmod 755 /config/userdata if [ -n "${GITHUB_TOKEN}" ]; then echo "https://oauth2:${GITHUB_TOKEN}@github.com" > /config/userdata/.git-credentials chown 1000:1000 /config/userdata/.git-credentials chmod 600 /config/userdata/.git-credentials fi volumeMounts: - name: userhome mountPath: /config env: - name: GITHUB_TOKEN valueFrom: secretKeyRef: name: $(SECRET_NAME) key: GITHUB_TOKEN optional: true ``` ### Option 2: Fix init-repo Script Modify the init-repo script to: 1. Create the directory if it doesn't exist 2. Handle permission errors gracefully 3. Use appropriate user context ## Environment Details - Devcontainer Helm chart v0.2.2 - IDE: antigravity - Container user: root (uid=0) with app group (gid=1000) - Volume mount: /config (persistent volume) ## Related Context - Kubernetes deployment: `cpfarhood/kubernetes` repository - The issue occurs when `ide: antigravity` is set in the Helm values
cpfarhood commented 2026-02-23 01:26:50 +00:00 (Migrated from github.com)

Addressed. The setup-userdata init container in deployment.yaml now runs mkdir -p /config/userdata before the main container starts, ensuring the directory exists for git credential writes. The init-repo.sh script also handles both token-present and token-absent cases.

Addressed. The `setup-userdata` init container in `deployment.yaml` now runs `mkdir -p /config/userdata` before the main container starts, ensuring the directory exists for git credential writes. The `init-repo.sh` script also handles both token-present and token-absent cases.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: farhoodlabs/devcontainer#28