Skip to content

Instantly share code, notes, and snippets.

@tetsuyainfra
Created April 2, 2017 08:42
Show Gist options
  • Save tetsuyainfra/cd1b4dac9859f96755249c3f12a42086 to your computer and use it in GitHub Desktop.
Save tetsuyainfra/cd1b4dac9859f96755249c3f12a42086 to your computer and use it in GitHub Desktop.
Capistranoでdeploy前にgit pushするタスクを追加する
#!/bin/sh
exec ssh -F keys/ssh_config "$@"
# lib/capistrano/tasks/sync.rake
namespace :sync do
desc 'run synchronization remote repository'
task :git do
on roles(:all) do | host |
# run command in local
run_locally do
# if you want ssh warapper
with GIT_SSH: "keys/git_ssh.sh" do
execute :git, :push, "#{host}", "release/*"
end
end
end
end
before :deploy, :'sync:git'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment