开发者

Git (host) + shared webhost - workflow?

I have this really nice webhost that I really like and I would like to stay there. I have this really nice git curiosity开发者_开发知识库 to work with, so GitHub is the place to go.

Unfortunately, the host don't support git, or any other subversion system.

My question is: How can I marry both under some development workflow? The files will be on the webhost and the "git repository" on gitHub can this be done?

Update: The host doesn't provide shell access so I believe. (Not confirmed). If they do support, what should I ask?

Thanks a lot,

MEM


Since your host doesn't support Git you'll have to get a little creative with your deploy strategy. For development, you should be good since your development machine can push/pull from gihub.

You can deploy to your web server from Github by using the downloads feature. When you're ready to deploy a release, tag your repo and push the tag up to github ( git push --tags ). On github, this will create a download tarball. From your webhost, just wget this download into your directory and un-tar it to the directory that serves the webpages. You may need to copy in your configuration files that aren't in the repo.

You can also do all this with the git bundle command.


If the host gives you shell access :

git clone <your repo>

If you have shell access and not git, you can compile git in your user directory.

Else, you could set-up a git-hook that pushes to your ftp/....

Here's the guide to git hooks : http://book.git-scm.com/5_git_hooks.html You set it up on your own directory so that it issues the command to push to your ftp


One potential alternative to hooks is https://github.com/ezyang/git-ftp, a script you would run from your local machine that makes dealing with FTP a bit less painful by uploading only changed files. I would continue to use GitHub (or another git hosting solution) for backup/collaboration purposes, but you can then also "deploy" to your shared web host using git-ftp.

On a separate note: While I understand your desire to stick with your shared web host, I highly recommend that you consider upgrading to a VPS or similar at some point. Having git on my VPS (and making it a part of my workflow and deploy strategy) saves hours of work. Even shell access alone can dramatically speed things up, once you start learning how to take advantage of it.

Perhaps your shared web host also offers a VPS plan?


If you have shell access, you can write a custom post-receive hook on github.com. You deployed code should be symbolically linked from another directory outside your webroot and after every deployment you can change the symbolic link to the last updated code. Make sure that you don't upload the .git folder or make sure that apache doesn't serve those files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜