Skip to content

Instantly share code, notes, and snippets.

@rvera-vecode
Forked from noelboss/git-deployment.md
Created May 14, 2023 21:37
Show Gist options
  • Save rvera-vecode/017d7787265e69c23586ee92ae625fa8 to your computer and use it in GitHub Desktop.
Save rvera-vecode/017d7787265e69c23586ee92ae625fa8 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