views:

521

answers:

2

I have a remote git repository setup for centralized development within my team. However, the production server that we deploy our applications currently does not have git running on it. We want to use capistrano to deploy our applications how can we set up our deploy recipes to 'pull' from the remote git repositories when deploying?

In other words can I do something like this?

set :repository, "myserver.com/git/#{application}.git"
set :scm, "git"
set :deploy_via, :copy
A: 

Have you tried something like

set :repository, "myserver.com/git/#{application}"
set :scm, :none
set :deploy_via, :copy

I've never tried this, but this seems to be the sort of approach you would need to go about using. A little more insight in the Capistrano RDocs.

theIV
I echo this. Using :copy is about the only option you have unless you install a git client on your server.
Mark S.
If you set `scm` to none, it'll just zip up a copy the whatever's on your local machine and transfer that to the server instead of doing a git clone locally and transferring that.
Emily
Actually, on second look, that will fail. When you set `scm` to none, `repository` is expected to be a directory path, not a URL. Your solution will look for the directory `myserver.com` on the local machine. Usually, when `scm` is none, you set `repository` to `'.'`
Emily
+3  A: 

The solution in your question is close to correct. You'll need to specify your git repository a little differently, though. What you need is:

set :repository, "someuser@somehost:/home/myproject"
set :scm, "git"
set :deploy_via, :copy

There's more examples of how to set up git deployment in your Capistrano gem under lib/capistrano/recipes/deploy/scm/git.rb.

What happens when you use the copy deploy strategy is that Capistrano clones your git repo to /tmp on your local machine, tars & zips the result, and then transfers it to the server via sftp. The copy strategy also supports copying via scp, but there's no way to tell it to do that without hacking around in the source a bit.

Emily