Git Strategy
The Git strategy clones your repository directly on the server via SSH and installs dependencies there.
How It Works
- Build assets — GitHub Actions builds Node/CSS/JS assets locally (Netsons doesn’t have Node)
- 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 from the runner 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
/usr/local/bin/composer(configurable viaREMOTE_COMPOSER) - PHP CLI — use the full path (e.g.,
/usr/local/bin/ea-php84) - SSH access — with key authentication
Public Repositories
For public repos, set GIT_REPO to the HTTPS URL:
https://github.com/user/repo.gitNo additional configuration is needed.
Private Repositories
Netsons shared hosting blocks outbound SSH (port 22), so the git strategy uses HTTPS with token authentication for cloning.
Using GITHUB_TOKEN (recommended for same-repo deploys)
Edit your .github/workflows/deploy.yml and change the GIT_TOKEN line in the “Deploy via Git” step:
GIT_TOKEN: ${{ github.token }}github.token is automatically provided by GitHub Actions with read access to the repository. No secrets to create or rotate.
Using a Personal Access Token (cross-repo or fine-grained control)
- Create a fine-grained PAT at github.com > Settings > Developer settings > Personal access tokens > Fine-grained tokens
- Grant read-only access to the repository contents
- Add it as a secret named
GIT_TOKENin your repo (Settings > Secrets) - The workflow already references
${{ secrets.GIT_TOKEN }}
See GitHub Secrets for details.
Composer on Netsons
Composer must be invoked with the correct PHP binary:
/usr/local/bin/ea-php84 /usr/local/bin/composer install --no-devThe action handles this automatically using the remote-php and remote-composer inputs. The default Composer path is /usr/local/bin/composer. If your server has Composer at a different location, set the composer_binary config option or the REMOTE_COMPOSER workflow env var.
The git deploy step also creates bootstrap/cache before running composer install, since this directory is gitignored but required by Composer’s post-autoload-dump scripts.
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.