sudo -u deploy git -C /opt/myapp pull origin main

Category: VPS Management

sudo -u deploy git -C /opt/myapp pull origin main

Pull latest code as the deploy user

git -C runs the command in the given directory without a cd; sudo -u deploy runs it as the deploy user, who owns the checkout — necessary when the repo was cloned by that account and root would otherwise hit ownership errors. A clean pull here means the working tree matched, keeping deploy state predictable.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.