Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 在分支上部署失败-不是有效的对象名称_Git_Capistrano - Fatal编程技术网

Git 在分支上部署失败-不是有效的对象名称

Git 在分支上部署失败-不是有效的对象名称,git,capistrano,Git,Capistrano,我正试图在Capistrano部署另一个分支。部署主分支工作正常,但我的“daniel”分支失败,出现以下错误: 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/r

我正试图在Capistrano部署另一个分支。部署主分支工作正常,但我的“daniel”分支失败,出现以下错误:

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
INFO[e8d2a50d]Running/usr/bin/env git archive daniel | tar-x-C/data/apps/dimsum.staging/releases/20150922073756 on
调试[e8d2a50d]命令: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)
调试[e8d2a50d]致命:不是有效的对象名称
调试[e8d2a50d]tar:这看起来不像tar存档
调试[e8d2a50d]tar:由于以前的错误而以失败状态退出
帽子流产了!
SSHKit::Runner::ExecuteError:在主机上执行时发生异常:git退出状态:2
git stdout:什么都没写
git stderr:致命:不是有效的对象名称
tar:这看起来不像tar归档
tar:由于以前的错误而以失败状态退出
这些是我的部署文件:

#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
#deploy.rb
集合:应用程序“dimsum_v2”
集合:repo_url,'git@bitbucket.org:.git'
#staging.rb
设置:stage,:staging
集合:应用程序,“dimsum.staging”
设置:app_路径,“/data/apps/#{fetch(:application)}”
布景:布兰奇,“丹尼尔”
set:deploy\u to,fetch(:app\u path)
服务器“”,用户:“部署”,角色:%w{web app},my_属性::my_值
直接在服务器上克隆master和daniel分支也可以正常工作。例如:

git clone -b daniel  git@bitbucket.org:<git repo>.git
git克隆-b丹尼尔git@bitbucket.org:.吉特

有什么问题吗?

如果您确定
git@bitbucket.org:.git
daniel分支,那么可能在Capistrano创建/data/apps/dimsum.staging/repo文件夹时它不在那里


只需在服务器中rm repo/dir,这样cap就可以从头开始创建它(:

我找到了另一个临时解决方案。我将按照您的建议稍后尝试删除该文件夹。我还在Capistrano创建repo文件夹后创建了一个分支。但是删除repo文件夹没有任何帮助。主分支完美部署,新分支失败。还要确保分支存在并且部署文件中没有键入错误(这是我的问题所在,facepalm)