开发者

How could I use git to deploy?

Basically I thought I could use git for deployment as those rails cloud 开发者_开发问答providers as heroku offer. So I created an app on the server, changed to that directory and did a git init in there. Next I created a http server with git-wep pointing that directory. Now I check out, that`s fine too and edit and commit to my repo.

Now, what I want to do next, would be to push to the server and have it update it's working directory as a post commit hook. deployed.

But git won't let me push. Probably I could

You can set 'receive.denyCurrentBranch' configuration variable to 'ignore'

but where would I do that? Where and how could I place the hook?


It'd be better to have the repository on the server be a bare repository (one that does not actually have a working copy - only the contents of the .git directory), and then use something like git archive | tar -x -C /path/to/htdocs in post-receive-hook to export the files into the served directory.

By using a bare repository as your target, you avoid the issue of pushing to a checked-out branch entirely.

To create a bare repository, pass the --bare flag when you init:

git --bare init
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜