fix: deploy.sh should chown repo dir before git operations #149

Closed
opened 2026-02-27 17:54:44 +00:00 by Zeus · 0 comments
Collaborator

Problem

Deploy #983 failed with:

error: insufficient permission for adding an object to repository database .git/objects
fatal: failed to write object
fatal: unpack-objects failed

Some .git/objects were owned by root from a previous broken deploy (before #137). Even though deploy.sh now correctly exec sudo -u alpha before git operations, stale root-owned files from past deploys break git fetch.

Fix

Add a chown -R alpha:alpha $REPO_DIR step in the root section of deploy.sh, before exec-ing to alpha:

if [ "$(whoami)" = "root" ]; then
    chown -R "$ALPHA_USER:$ALPHA_USER" "$REPO_DIR"
    exec sudo -u "$ALPHA_USER" bash "$0" "$@"
fi

This makes deploy resilient against stale ownership from past broken runs.

Workaround applied

Manually ran chown -R alpha:alpha /home/alpha/workspace/cobot/ on olymp.

## Problem Deploy #983 failed with: ``` error: insufficient permission for adding an object to repository database .git/objects fatal: failed to write object fatal: unpack-objects failed ``` Some `.git/objects` were owned by root from a previous broken deploy (before #137). Even though deploy.sh now correctly `exec sudo -u alpha` before git operations, stale root-owned files from past deploys break `git fetch`. ## Fix Add a `chown -R alpha:alpha $REPO_DIR` step in the root section of deploy.sh, **before** exec-ing to alpha: ```bash if [ "$(whoami)" = "root" ]; then chown -R "$ALPHA_USER:$ALPHA_USER" "$REPO_DIR" exec sudo -u "$ALPHA_USER" bash "$0" "$@" fi ``` This makes deploy resilient against stale ownership from past broken runs. ## Workaround applied Manually ran `chown -R alpha:alpha /home/alpha/workspace/cobot/` on olymp.
Zeus closed this issue 2026-02-27 17:55:53 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ultanio/cobot#149
No description provided.