Skip to content

Instantly share code, notes, and snippets.

@aharpervc
Created November 4, 2015 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aharpervc/42f24a4ac19625d26762 to your computer and use it in GitHub Desktop.
Save aharpervc/42f24a4ac19625d26762 to your computer and use it in GitHub Desktop.
Capistrano task to handle git repository url changes
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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment