Git deployment lets you deploy a website to hosting with the
git push command. You can find the exact remote repository address
and commands for a specific domain in Administration → My domains →
select a domain → Git.
How Git deployment works
A push to the remote production branch automatically publishes
a new version of the website. When deploying, the repository root is
copied directly into the www folder on the hosting.
Because of this, do not create an additional wrapper www folder in
the repository for deployment.
You can use other branches for normal development. Only a push to the
production branch changes the website content.
Activating Git
- In the administration, open the Git settings for the selected domain.
- Add the public SSH key of your computer. Adding the first key automatically activates Git.
- After activation, the remote repository address will be displayed, for
example
git@server.blueboard.cz:vasedomena.cz.
If the administration shows information about an older hosting version instead of Git settings, contact our support. We first need to migrate the hosting to the current way of working with subdomains.
Creating an SSH key
If you don’t have an SSH key yet, run in Terminal or PowerShell:
ssh-keygen -t ed25519
Confirm the proposed file location. The private key stays on your computer and you must not send it to anyone.
You can display the public key on macOS or Linux with:
cat ~/.ssh/id_ed25519.pub
In Windows PowerShell use:
Get-Content $env:USERPROFILE\\.ssh\\id_ed25519.pub
Paste the entire printed line starting with ssh-ed25519 into the
administration.
Connecting the project
Always copy the exact remote address from the administration. The following address is only an example.
Existing local project
In the project root folder, add the hosting as a new remote:
git remote add blueboard git@server.blueboard.cz:vasedomena.cz
You can change the name blueboard. Further examples in this
guide use this name.
Empty project
If you want to start with a repository created on the hosting, clone it:
git clone git@server.blueboard.cz:vasedomena.cz
Repository structure
The repository root corresponds to the www folder on the
hosting. The optional .deploy file and any
composer.json therefore belong directly in the repository root. The
rest of the project structure can be arbitrary.
repozitář/
├── .deploy
├── composer.json
├── composer.lock
└── …
After deployment, these files will be available on the hosting as
www/.deploy, www/composer.json, and
www/composer.lock.
First and subsequent deployments
First, save your changes to local Git:
git add .
git commit -m "First deployment"
Deploy the current commit with:
git push blueboard HEAD:production
The HEAD:production notation sends the current local commit to
the remote production branch. You don’t need to create or switch
to a separate branch locally.
Warning: Deployment may overwrite files that are currently uploaded to the website via FTP.
Automatic commands after deployment
You create the optional www/.deploy file on the hosting as
.deploy in the repository root. Put each command on a separate
line, for example:
composer install
delete temp/cache
url https://vasedomena.cz/deploy-finished
composer installrunscomposer install --no-devin thewwwfolder on the hosting. Thecomposer.jsonandcomposer.lockfiles therefore must be in the repository root.delete pathremoves the specified file or directory relative to thewwwfolder. You can use the command multiple times.url addressloads the specified URL after the deployment finishes. You can use the command multiple times.
For further changes, just create a new commit and run again:
git push blueboard HEAD:production