Skip to content

Instantly share code, notes, and snippets.

@AlanSynn
Forked from noelboss/git-deployment.md
Created April 29, 2020 08:03
Show Gist options
  • Save AlanSynn/fc55a2d2469cf7a7a1ad75a64c0bbc30 to your computer and use it in GitHub Desktop.
Save AlanSynn/fc55a2d2469cf7a7a1ad75a64c0bbc30 to your computer and use it in GitHub Desktop.
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.

But here, we add a "bare" git repository that we create on the production server and pusblish our branch (f.e. master) directly to that server. This repository acts upon the push event using a 'git-hook' to move the files into a deployment directory on your server. No need for a midle man.

This creates a scenario where there is no middle man, high security with encrypted communication (using ssh keys, only authorized people get access to the server) and high flexibility tue to the use of .sh scripts for the deployment.

Todos

  1. Have a local working-working copy ready
  2. Add a bare repository on the productions server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment