Giter Club home page Giter Club logo

git-hook-deploy's Introduction

git-hook-deploy

This is a aimple setup for PHP server to automatically pull down your git repo.

The below scripts can be used a templates for you to get this setup on your own. At a minimum, you will want to change the variables in the scripts to reflect your environment.

deploy.php

You need to configure your git web hook to send a POST request to this PHP script whenever you push changes to a desired branch. All popular git service providors provide this functionality.

All this script does is verify that there is a POST request and then simply create a file.

The next step is to setup a cron job that runs the below shell script.

check-deploy-hook.sh

This shell script check for the existence of a deploy hook file. If one is found, then it will go into your websites git repo. It will then perform a git reset and git pull on your repo. The latest updates will then get pulled down to your server.

Ensure that permissions are set to 700.

I schedule this job to run every 5 mins via a cron job.

*/5 * * * * /home/username/bin/check-deploy-hook.sh

Notes on setting up git

When you setup git on your server, you will want to make sure that you setup deployment ssh keys with your remote git service. This will make sure that everything is more secure. Check with your git service (Bitbucket, GitHub, etc) on how to set these up.

git-hook-deploy's People

Contributors

joeworkman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.