Git Strategy
The Git strategy clones your repository directly on the server via SSH and installs dependencies there.
How It Works
- Build — GitHub Actions prepares Laravel directories, builds Node assets locally (with dependency caching for faster builds)
- Clone — The repo is cloned on the server via SSH (
git clone --depth 1) - Install — Composer dependencies are installed on the server using the Netsons PHP binary
- Upload assets — Built CSS/JS assets are uploaded via SCP
- First deploy — If first deploy, generates
APP_KEYand runs configured seeders - Post-deploy — Symlinks set up,
.envvalues updated, migrations run, caches rebuilt - Switch — Atomic symlink update
- Cleanup — Old releases pruned, SSH agent cleaned up
When to Use
- Requires SSD 30+ plan (git must be available on server)
- Faster deployments (shallow clone instead of full FTP upload)
- Composer runs on server — ensure the server has enough resources
Server Requirements
- Git — available on SSD 30+ plans
- Composer — typically at
/opt/cpanel/composer/bin/composer - PHP CLI — use the full path (e.g.,
/usr/local/bin/ea-php84) - SSH access — with key authentication
SSH Key for Git Clone
The server needs SSH access to your GitHub repository. Options:
- Deploy key — add a read-only deploy key to the repo (GitHub > Repository > Settings > Deploy keys)
- SSH key — use the same key configured for server access
Composer on Netsons
Composer must be invoked with the correct PHP binary:
/usr/local/bin/ea-php84 /opt/cpanel/composer/bin/composer install --no-devThe action handles this automatically using the remote-php input.
Configuration
Set the strategy in config/netsons-deploy.php:
'strategy' => env('NETSONS_DEPLOY_STRATEGY', 'git'),
'git' => [ 'repo' => env('NETSONS_GIT_REPO'), 'branch' => env('NETSONS_GIT_BRANCH', 'main'),],Server Directory Structure
Same layout as FTP — see FTP Strategy.