I have a simple deployment via capistrano from a Git repository.
I wanted to change the repository I was working with so I basically just changed
set :repository, "[email protected]:new_repository"
But i get the following error when deploying:
fatal: Could not parse object '9cfb...'.
The problem goes away once I change
set :deploy_via, :remote_cache
to
set :deploy_via, :copy
I also tried deploy:cleanup but I get the following error:
*`deploy:cleanup' is only run for servers matching {:except=>{:no_release=>true}}, but no servers matched*
Any idea how could i get remote_cache working again?
Thansk!
With capistrano 3, to avoid deleting the repo folder :
Change the repo URL in your config/deploy.rb
, as the OP already did
SSH to your server inside and change the remote URL of the git repo :
ssh [email protected]
# Go the capistrano deploy root
cd /capistrano/deploy/root/folder
# Go inside the folder names *repo*
cd repo
# Manually change the git remote
git remote set-url origin ...
Additional info for Capistrano 3 users. Capistrano will create a folder repo
. So the structure looks like this:
current -> /var/www/preview/releases/20140612212305
releases
repo
revisions.log
shared
When you change the :repo_url
in deploy.rb
you can safely remove the repo
folder and run the deployment. The folder will be created again. The reason why you have to do this step is because in repo/config is the old remote url.
Capistrano < 3
Fix it in ./shared/cached-copy/.git/config from deployment folder of your server.
OR ugly way do this:
Remove the shared/cached-copy from deployment folder of your server.
Capistrano > 3
Fix it in ./repo/config from deployment folder of your server.
Learn How to fix similar issues
It is caused as your server files are referring to old repo so you have to find and fix it. Do this to find matches in files:
cd /path/to/your/project
grep -r OLD_REPO_NAME ./
Now you see all files including your OLD_REPO_NAME . If they are matched in your release folder or current, you dont need to care for fixing them. But you should fix all configs.
you can just change the git url in
shared/cached-copy/.git/config
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With