How to Configure Capistrano to Deploy from Local Git Repository? How to Configure Capistrano to Deploy from Local Git Repository? ruby-on-rails ruby-on-rails

How to Configure Capistrano to Deploy from Local Git Repository?


That's easy:

set :scm, :noneset :repository, "."set :deploy_via, :copy

Simply run Capistrano from the root of your project.


The deploy_via, :copy has been dropped in version 3.

https://github.com/capistrano/capistrano/issues/695

In most cases you should have your code in a online repository like github or bitbucket, and then you just have to set this line in your deploy.rb file:

set :repo_url, 'git@bitbucket.org:my_account/my_project.git'

Though if you happen to have a repository on the remote server that you are deploying too, then you would change that line in your deploy.rb file to be this:

set :repo_url, 'file:///home/deploy/bare_repo/my_project.git'

Keep in mind that the three forward slashes are important since the file:// tells capistrano that you are looking for a file, and the preceding slash is needed to point to a root path which would be something like /home/deploy/bare_repo/my_project.git.


set :repository, 'file:///path/to/your/git_repository'set :local_repository, "file://."set :scm, :git# set :deploy_via, :copy # you must comment it