Skip to main content
git push

How to use git push to do push changes to your Templ site.

Emanuel avatar
Written by Emanuel
Updated over a year ago

Before you get started using git push to deploy changes to your site, we assume the following:

- You already have a website set up on Templ that you want to push changes to.

- You have an existing git repo that you want to push changes from, e.g. on a local development environment.

Prepare your site on Templ

First you need to create a bare git repo on your Templ site.

Connect to your site using SSH and create a bare git repo:

git init --bare wordpress.git

Then we need to add a script for the files to actually be updated when changes are pushed to the repo:

nano wordpress.git/hooks/post-receive

Insert following content:

#!/bin/bash
git --work-tree=/home/user_xxxx/app_xxxx --git-dir=/home/user_xxxx/wordpress.git checkout -f

NOTE: The path to your work-tree and git-dir must be valid! You can find the user and webroot of your site in the Templ control panel.

Make the script executable:

chmod +x wordpress.git/hooks/post-receive

Add your remote repo to your local environment and push

Now we can go to our local git repo that we want to push changes from, and add our remote repo that's on Templ:

git remote add templ ssh://user_xxxx@xxx.xxx.xxx.xxx:xxxxx/home/user_xxxx/wordpress.git

NOTE: The remote must be entered like ssh://<user>@<hostname>:<port>/<path>. You can find the the SSH credentials for your site in the Templ control panel.

And now we can push changes to Templ like so:

git push templ master
Did this answer your question?