Home VPN WorkPlace Web Sites/Apps Small Business Other Apps Contact Guides

GIT Simple Host and Deploy (SSH)


Install GIT
sudo apt update && sudo apt install git -y

You will have to setup a folder for your Repositories and another for your website/application.

As I generally dedicate my web servers to their projects, my example config is /git for repositories and /web for web app.

The Branch I will use as a deployment target is env_prod

Setup Web App Folder
sudo mkdir -p /web/webapp
Setup Repository Folder
sudo mkdir -p /git/webapp.git
Set your permissions: I will update shortly...
Create Repository
cd /git/webapp.git
git init --bare
Now to setup a hook to deploy on a specific branch.
cd hooks
Setup the event by creating a small bash script to fire on updates.
nano post-receive
git --git-dir=/git/webapp.git --work-tree=/web/webapp checkout -f env_prod
Now save exit and set as executable.
chmod +x post-receive

Now you can checkout, build and push your changes with GIT. To deploy, merge and push your changes to the env_prod branch. If you would like to perform any additional tasks, you can add to the bash script.


Create and navigate to your project folder, you can use the terminal in VS Code for this.

git clone git@ .
A couple of extra's you may need if you haven't done so already...
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

Make changes and when your ready... Create/Push to env_prod

If you would like to save your credentials, use:
CAMM Services Application Design
Brantford PC
Norfolk County PC
R.D. Cookson Disposal Ltd.
Web Site Design Brantford, Ontario
Web Site & Application Development Norfolk County, Ontario
Various front loader and roll off bin rentals in Simcoe, Ontario
3D Marketing and Exhibit Specialists, Greater Toronto Area
Robert Jones Marine Technical Services