首页 > 解决方案 > Capistrano Deploy 无法找到 Github 存储库

问题描述

尝试在 AWS 上部署 Rails 应用程序时,我会收到以下错误bundle exec cap production deploy


00:01 git:update
      01 git remote set-url origin git@github.com:AskBid/delegations-explorer-backend.git
    ✔ 01 deploy_user@ec2-x-x-x-x.eu-west-2.compute.amazonaws.com 0.066s
      02 git remote update --prune
      02 Fetching origin
    ✔ 02 deploy_user@ec2-x-x-x-x.eu-west-2.compute.amazonaws.com 1.148s
00:03 git:create_release
      01 mkdir -p /var/www/delegations-explorer-backend/releases/20201229124628
    ✔ 01 deploy_user@ec2-x-x-x-x.eu-west-2.compute.amazonaws.com 0.065s
      02 git archive master | /usr/bin/env tar -x -f - -C /var/www/delegations-explorer-backend/releases/20201229124628
      02 fatal: Not a valid object name
      02 tar:
      02 This does not look like a tar archive
      02
      02 tar:
      02 Exiting with failure status due to previous errors
      02

我在网上发现了很多类似的问题,解决方法一直是他们没有在 GitHub 上推送存储库或者存储库不存在。

就我而言,回购就在那里..所以我不知道如何解决这个问题。

这是我的deploy.rb

set :application, "delegations-explorer-backend"
set :repo_url, "git@github.com:AskBid/delegations-explorer-backend.git"
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads')
set :rvm_ruby_version, '2.6.3'
set :passenger_restart_with_touch, true

标签: amazon-web-servicesruby-on-rails-4deploymentcapistrano

解决方案


默认情况下,capistrano 部署master分支。但是您的存储库仅包含一个main分支。

只需将 capistrano 配置为从main分支部署。

set :branch, "main"

推荐阅读