Deploy web project under GIT version control to sh

2019-03-16 03:46发布

问题:

I am developing a wordpress theme which is under version control using Git and in a local development area ( WAMP ). I push commits to bitbucket using smartgit as a GUI. I have 2 branches, master and development. I want to deploy the development branch to a staging area ( a wordpress install on my live server). I have tried using ftploy which does achieve this; however it doesn't seem to allow me to choose which branch to deploy and I want to reserve deployment of the master branch for the actual final deployment. I am using shared hosting but I have SSH access. How can I best achieve deployment of the development branch to the shared hosting. Git is not installed on the server ( and can't be )

回答1:

there is an article that suggest 8 apps for git auto-deploy

Beanstalk — http://beanstalkapp.com/

FTPloy — http://ftploy.com/

Deploy — https://www.deployhq.com/

Springloops — http://www.springloops.io/

Wercker — http://wercker.com/

Octopus Deploy [.net] — https://octopusdeploy.com/

Capistrano [Ruby] — http://capistranorb.com/

Bamboo + Phing [PHP]— https://www.atlassian.com/software/bamboo



回答2:

have a look at git-ftp:

I use git-ftp for my script based projects, mostly PHP. Most of the low-cost web hosting companies do not provide SSH or git support, but only FTP.

That is why I needed an easy way to deploy my git tracked projects. Instead of transfering the whole project, I thought, why not only transfer the files that changed since the last time, git can tell me those files.

Even if you are playing with different branches, git-ftp knows which files are different. No ordinary FTP client can do that.



回答3:

I'm the founder of FTPloy and I just wanted to let you know that we've now released the branch selection functionality.



回答4:

Ended up using this script which does exactly what I want. Actually it was written by the same guy who built ftploy but because I had access to the script I was able to determine which branch got deployed. By the way I discovered that the ftploy roadmap includes being able to Select Branch for Bitbucket projects.



回答5:

Since you have SSH access, it would seem to me you could set up a rsync command in the git post-receive hook script. See https://github.com/EugeneKay/scripts/blob/master/bash/git-deploy-hook.sh I used this with gitolite but I am sure it is possible to do something similar with a github hook as well (anyone?)