【问题标题】:Deploy fails on branch - Not a valid object name部署在分支上失败 - 不是有效的对象名称
【发布时间】:2015-09-22 07:50:23
【问题描述】:

我正在尝试使用 Capistrano 部署另一个分支。部署主分支工作正常,但我的“丹尼尔”分支失败并出现以下错误:

INFO[e8d2a50d] Running /usr/bin/env git archive daniel | tar -x -C /data/apps/dimsum.staging/releases/20150922073756 on <ip number>
DEBUG[e8d2a50d] Command: cd /data/apps/dimsum.staging/repo && ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/dimsum.staging/git-ssh.sh /usr/bin/env git archive daniel | tar -x -C /data/apps/dimsum.staging/releases/20150922073756 )
DEBUG[e8d2a50d]     fatal: Not a valid object name
DEBUG[e8d2a50d]     tar: This does not look like a tar archive
DEBUG[e8d2a50d]     tar: Exiting with failure status due to previous errors
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host <ip number>: git exit status: 2
git stdout: Nothing written
git stderr: fatal: Not a valid object name
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

这些是我的部署文件:

#deploy.rb
set :application, 'dimsum_v2'
set :repo_url, 'git@bitbucket.org:<git repo>.git'

#staging.rb
set :stage, :staging
set :application, "dimsum.staging"

set :app_path, "/data/apps/#{fetch(:application)}"
set :branch, 'daniel'
set :deploy_to, fetch(:app_path)
server '<ip number>', user: 'deploy', roles: %w{web app}, my_property: :my_value

直接在服务器上克隆 master 和 daniel 分支也可以正常工作。例如:

git clone -b daniel  git@bitbucket.org:<git repo>.git

可能是什么问题?

【问题讨论】:

    标签: git capistrano


    【解决方案1】:

    如果您确定 git@bitbucket.org:&lt;git repo&gt;.gitdaniel 分支,那么可能在 Capistrano 创建 /data/apps/dimsum.staging/repo 文件夹时它不存在。

    只需 rm 服务器中的 repo/ 目录,以便 cap 从头开始​​重新创建它(:

    【讨论】:

    • 我为此找到了另一个临时解决方案。稍后我会按照您的建议尝试删除该文件夹。
    • 在 Capistrano 创建 repo 文件夹后,我也做了一个分支。删除 repo 文件夹并没有帮助。 Master 分支部署完美,新分支失败。
    • 还要确保分支存在并且部署文件中没有错字(这就是我的问题,facepalm)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-08
    • 1970-01-01
    • 2013-12-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-31
    相关资源
    最近更新 更多