As I use Git and host the codes in GitHub and Bitbucket, to push the code to the production/staging servers is a pain. There are couple of ways I do it:
- Write a grunt task to push the codes to the server
- SSH into the server and run a
- Setup a git
post-receivehook using a bare repo. I’ve written a tutorial for this as well.
There are bunch of ways of doing it, but soon it gets pretty boring and overwhelming when you have to update those codes across multiple servers, or multiple places in a single server. GitPull addresses that issue and trying to solve this simple problem with a simple approach.
When you push the code to GitHub or Bitbucket, a webhook pings gitpull.io and after authenticating the request, we push those works in a job queue. When our workers pull the job, it logs in to your server via SSH public key authentication (we don’t require and store any password or any sensitive data whatsoever) and runs the following command:
cd /var/www/path/to/project git reset --hard HEAD # clear any local change git pull
Additionally if you specify, it runs few other commands as well:
composer install # optional npm install # optional composer dump-autoload -o # optional
All these commands are executed via a single command.