Skip to content

fix: add safe.directory configuration for git in deployment scripts#20

Merged
xukki241 merged 1 commit intomainfrom
dev
Mar 28, 2026
Merged

fix: add safe.directory configuration for git in deployment scripts#20
xukki241 merged 1 commit intomainfrom
dev

Conversation

@xukki241
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings March 28, 2026 14:21
@xukki241 xukki241 merged commit 1a731ac into main Mar 28, 2026
7 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Git safe.directory configuration during CD deployments to avoid “dubious ownership” errors when syncing the VM’s repo before running deployment steps.

Changes:

  • Configure Git safe.directory for $DEPLOY_PATH in the deploy SSH script.
  • Apply the configuration at both global and system Git config levels (with errors ignored).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +179 to +180
git config --global --add safe.directory "$DEPLOY_PATH" || true
sudo git config --system --add safe.directory "$DEPLOY_PATH" || true
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using git config --global --add safe.directory (and especially sudo git config --system --add ...) on every deploy will keep appending duplicate safe.directory entries to ~/.gitconfig and /etc/gitconfig, and it permanently mutates host configuration. Prefer a non-persistent approach (e.g., run the fetch/checkout/pull with git -c safe.directory="$DEPLOY_PATH" ...), or at least use --replace-all / guard so the value is only set once. Also consider dropping the --system write unless there’s a confirmed need to modify /etc/gitconfig.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants