Git push to DigitalOcean from Bitbucket or Cloud9

北城余情 提交于 2019-12-08 02:41:33

问题


I'm making site on Cloud9 IDE and I can't find the way to easy push my production code to DigitalOcean droplet server. Maybe there is some simple way I could do it as easy as it is to push code to Heroku from Cloud9. With simple command from Cloud9 console.

All my git code lives in Bitbucket so maybe you have ideas how to connect it to DigitalOcean?

Hope to hear how you do these production "pushes". You probably have well known techniques for these things.

Help!


回答1:


Your first, easy, option is to pull instead of push. Just do a

git clone

or a

git pull

On the droplet.

The harder way is to do a continuous integration (CI) environment such as Jenkins or CruiseControl. You are unlikely to find this functionality in a hosted git environment such as GitHub or BitBucket.

Some reading:

http://cruisecontrol.sourceforge.net/

https://jenkins-ci.org/




回答2:


You could set up git and git hooks on your DigitalOcean droplet to deploy your latest code on your server. Once everything's set up, you can just do git push production master (where production is a name I just gave, could be whatever you want) and your production environment will be re-deployed with the latest changes.

This article here: https://danbarber.me/using-git-for-deployment/ does a great job of getting you started, but, of course, there will be differences in your deployment code added within the hook.

Edit: Actually, this might be even better for you: https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps :)

Hope this helps.



来源:https://stackoverflow.com/questions/30088607/git-push-to-digitalocean-from-bitbucket-or-cloud9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!