Capistrano error tar: This does not look like a tar archive

拈花ヽ惹草 提交于 2019-11-30 04:08:31

I had the same issue, until I realized I was pulling the nonexistent branch from git.

Deleting app_name/repo also fixed this issue for me.

This happens when the repo in the server to deploy is messed up. We're talking about the bare git repo that Capistrano by default would put in /var/www/$application/repo (for other people's reference).

In your case it does not have a local feature/Capistrano branch so when running git archive feature/Capistrano nothing is output to that | pipe. To confirm, ssh into the server, cd into /home/rails/rails-capistrano/repo, and run git branch.

  1. It's running git archive as a way to export the selected branch's tree. git archive "writes it out to the standard output" so Capistrano redirects that to tar in order to uncompress the archive immediately into your new release directory. (Why Capistrano chose this instead of git checkout defeats me.)

  2. tar fails because it's receiving nothing d:

I can think of two possible solutions/ways to troubleshoot:

  • ssh into the server and manually delete the repo folder (e.g. in your case /home/rails/rails-capistrano/repo) as mentioned by @lugolabs
  • make sure the server's repo is using the remote you're expecting (ssh in, cd into repo/, and run git remote -v) -- you may just need to update your :repo_url in deploy.rb (and delete the repo/ dir).

I think that folder gets populated via a git pull, so it shouldn't be empty. If you do see it empty the issue is from the git not the tarball.

The issue I had was my capistrano deploy.rb repository URL was set to a different one than that project i was working in. In order to fix this issue, I also had to logon to the server and delete the app_name/repo folder which must have been caching the original bad remote URL.

Whenever I have hit this error it was because the branch specified in my deploy/environment.rb file wasn't checked into git. Do an add / commit / git push origin branch_name and that will likely make things work.

I'm using Bedrock Roots (wordpress) for development, capistrano for deploys and git flow. Stumbled upon this error when tried to deploy, while on hotfix/x.x.x branch locally. So I finished current (merged changes to develop branch) and then successfully deployed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!