task :cope_with_git_repo_relocation do on roles(:app) do capture "if [ -d #{repo_path} ]; then cd #{repo_path} && git remote set-url origin #{fetch(:repo_url)}; else true; fi" end end before :updating, 'deploy:cope_with_git_repo_relocation'