Deploying from Git the safe way with Git Manager and Supervisor

Git Manager now keeps /.git off the web on nginx, Apache and OpenLiteSpeed, fixes overlay clones into existing folders, accepts only real network URLs, and restarts Supervisor workers flagged for it after a successful deploy.

14 Nov 2026 4 min read 34 views
Deploying from Git the safe way with Git Manager and Supervisor
Share

Deploying a site with git pull is simple until it goes wrong in one of the quiet ways. The clone lands in the document root, and the web server happily serves /.git/config, which can contain an access token in the remote URL, along with the full history of your source. Or the pull works, but the queue worker that processes jobs keeps running yesterday's code until someone remembers to restart it. Git Manager, a Vinza Store app, now handles both of these, and recent releases tightened how a repository gets into an existing folder in the first place.

Git, per website, as the site's own user

Git Manager adds a Git tab to each website. From there you generate an SSH deploy key for the site, clone a repository, pull, fetch, check the status, browse commits, switch branches and discard local changes. Every Git command runs through the root agent as the website's Linux user, on the server that actually hosts the site. It never runs as root.

Push-to-deploy is optional. Turning it on gives you a webhook URL and secret to paste into GitHub, GitLab or Bitbucket. GitHub signatures and GitLab tokens are verified, a push deploys only when its branch matches the site's branch, and a short per-site cooldown merges bursts of pushes into one deploy.

Cloning into a folder that is not empty

Most new websites already have files in them, at least the panel's default index.html. When you clone into a folder that is not empty, Git Manager shows what is there and gives you two choices:

  • Overlay (fetch + reset): keep the folder, fetch the repository into it and reset it to the chosen branch. Files tracked by the repository take the repository's version.
  • Replace (delete all + clone): delete everything in the folder and clone fresh. This asks you to click a second time to confirm.

Overlay had a subtle failure mode that is now fixed. If an existing file was also part of the repository, the branch checkout was refused, and that error was ignored. The folder looked correct, but it sat on a local branch with no upstream, so every later Pull and webhook deploy failed with "There is no tracking information for the current branch". The checkout is now forced, and if it still fails the clone reports the real error instead of pretending to succeed.

/.git is never served

Because the working copy is the document root, the repository metadata sits in a public folder. Git Manager now closes that on every supported web server:

  • nginx: a per-site rule denies any path under /.git and returns 404. The rule is tested with nginx -t before nginx is reloaded, and removed again if nginx rejects it.
  • Apache and OpenLiteSpeed: a .htaccess file is written inside .git, as the site's owner. Apache answers 403 and OpenLiteSpeed 404.

The protection is applied after every clone or init and again at the start of every deploy. So repositories cloned before this change are closed by their next Pull or webhook deploy.

Only real network URLs

Repository URLs are checked before anything runs. The panel accepts https://, ssh:// and the git@host:path form, and nothing else. Local paths and other transports could otherwise reach repositories elsewhere on the same server. The panel's check now matches the agent's exactly, so a URL is refused once, with one clear message.

Deploy commands, history and worker restarts

A deploy is more than a pull for most applications. Git Manager lets you set post-deploy commands per site, such as composer install, npm ci && npm run build or php artisan migrate. They run as the site's account after every pull, from the button or the webhook, with the output shown live. If a command fails, the deploy is marked failed, and a failed webhook deploy notifies the site owner. Each site keeps a history of its last 30 deploys: when, what triggered it, the commit before and after, the result and the end of the output. You can also deploy a specific commit from the log to roll back.

The last step is the one that is easy to forget. In the Supervisor app, a program can be marked Restart after a deploy, and the worker templates that start from a website, such as a Laravel queue worker, turn it on. When a deploy succeeds, Git Manager calls Supervisor's post-deploy hook, which restarts the flagged programs that run as that site's user from the site's folder or a folder inside it. Workers belonging to another user, or running outside the site, are never touched. A failed deploy restarts nothing, so your workers keep running the last good code.

Worker restarts are written to the deploy log, including a note if some could not be restarted.

How to get it

Install Git Manager from the Vinza Store in your panel, then open any website and go to its Git tab. The server needs the git binary. For worker restarts you need Git Manager 1.2.1 or later together with Supervisor 1.0.6 or later. The overlay fix, the URL check and the /.git rule for nginx shipped with panel 1.4.24, and the Apache and OpenLiteSpeed rule with 1.4.26, so update the panel from Vinza Connect → Panel Update if you are on an older release. Changelogs are on the release page.