Hegwin.Me

The bitterest tears shed over graves are for words left unsaid and deeds left undone.

How to Deploy with Capistrano after Repo URL changed?

修改Repo地址后Capistrano部署问题

We are using Capistrano to deploy our project and recently migrated the project repository from BitBucket to Github. I thought I could just simply change set :repo_url in config/deploy.rb, but that's not the case.

When I executed the deployment with Cap, I saw that the code in the log was still taken from the BitBucket repo, and all the changes made after the migration to GIhub were not included.

I searched the internet and found that I needed to ssh into the server to change the repo address, so I really made a fool of myself.

Open /var/www/my-project/repo/config

[core]
        repositoryformatversion = 0
        filemode = true
        bare = true
[remote "origin"]
        url = git@bitbucket.com:hegwin/my-project.git
        fetch = +refs/*:refs/*
        mirror = true

Change the url to the URL of the new repo and redeploy it locally.

Also, don't forget to add the Deploy Key again.

Ref: https://coderwall.com/p/4k1lja/fixing-capistrano-3-deployments-after-a-repository-change

< Back