Capistrano tmp:dir错误:无法运行git-ssh.sh:没有这样的文件或目录



在我的服务器上,我不允许创建一个执行任何内容的tmp文件夹。因此,使用capistrano 3,我可以选择为一种自定义tmp文件夹设置路径。是否有任何语法我必须考虑,导致我的设置执行一个错误与cap staging部署:

INFO[f99c486e] Running /usr/bin/env mkdir -p custom_tmp/myproject/ on xxxx.de
DEBUG[f99c486e] Command: /usr/bin/env mkdir -p custom_tmp/myproject/
INFO[f99c486e] Finished in 1.140 seconds with exit status 0 (successful).
DEBUGUploading custom_tmp/myproject/git-ssh.sh 0.0%
INFOUploading custom_tmp/myproject/git-ssh.sh 100.0%
INFO[91b7d9b8] Running /usr/bin/env chmod +x custom_tmp/myproject/git-ssh.sh on xxxx.de
DEBUG[91b7d9b8] Command: /usr/bin/env chmod +x custom_tmp/myproject/git-ssh.sh
INFO[91b7d9b8] Finished in 0.080 seconds with exit status 0 (successful).
DEBUG[f4db290c] Running /usr/bin/env git ls-remote -h git@bitbucket.org:hallo/www.myproject.de.git on xxxx.de
DEBUG[f4db290c] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=custom_tmp/myproject/git-ssh.sh /usr/bin/env git ls-remote -h git@bitbucket.org:hallo/www.myproject.de.git )
DEBUG[f4db290c]     66791b22a61cd1af57d117a817129e491e83d88c    refs/heads/master
DEBUG[f4db290c] Finished in 3.235 seconds with exit status 0 (successful).
INFO[74118c8e] Running /usr/bin/env mkdir -pv development/myproject/shared development/myproject/releases on xxxx.de
DEBUG[74118c8e] Command: /usr/bin/env mkdir -pv development/myproject/shared development/myproject/releases
INFO[74118c8e] Finished in 0.079 seconds with exit status 0 (successful).
INFO[10e40636] Running /usr/bin/env mkdir -pv development/myproject/shared/media on xxxx.de
DEBUG[10e40636] Command: /usr/bin/env mkdir -pv development/myproject/shared/media
INFO[10e40636] Finished in 0.086 seconds with exit status 0 (successful).
DEBUG[38889a64] Running /usr/bin/env [ -f development/myproject/current/REVISION ] on xxxx.de
DEBUG[38889a64] Command: [ -f development/myproject/current/REVISION ]
DEBUG[38889a64] Finished in 0.079 seconds with exit status 1 (failed).
DEBUG[5dfc387f] Running /usr/bin/env [ -f development/myproject/repo/HEAD ] on xxxx.de
DEBUG[5dfc387f] Command: [ -f development/myproject/repo/HEAD ]
DEBUG[5dfc387f] Finished in 0.095 seconds with exit status 1 (failed).
DEBUG[44d0214c] Running /usr/bin/env if test ! -d development/myproject/; then echo "Directory does not exist 'development/myproject/'" 1>&2; false; fi on xxxx.de
DEBUG[44d0214c] Command: if test ! -d development/myproject/; then echo "Directory does not exist 'development/myproject/'" 1>&2; false; fi
DEBUG[44d0214c] Finished in 0.079 seconds with exit status 0 (successful).
INFO[dac1f8fd] Running /usr/bin/env git clone --mirror git@bitbucket.org:hallo/www.myproject.de.git development/myproject/repo on xxxx.de
DEBUG[dac1f8fd] Command: cd development/myproject/ && ( GIT_ASKPASS=/bin/echo GIT_SSH=custom_tmp/myproject/git-ssh.sh /usr/bin/env git clone --mirror git@bitbucket.org:hallo/www.myproject.de.git development/myproject/repo )
DEBUG[dac1f8fd]     Cloning into bare repository development/myproject/repo...
DEBUG[dac1f8fd]     error: cannot run custom_tmp/myproject/git-ssh.sh: No such file or directory
DEBUG[dac1f8fd]     fatal: unable to fork
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host xxxx.de: git exit status: 128
git stdout: Nothing written
git stderr: Nothing written

在我的服务器上,文件夹"custom_tmp/myproject/"仍然在那里,那里有git-ssh.sh。我想知道误差是什么。这里是我的deploy.rb

#config valid only for Capistrano 3.1
lock '3.2.1'
set :application, 'myproject'
set :repo_url, 'git@bitbucket.org:hallo/www.myproject.de.git'
# Default deploy_to directory is /var/www/my_app
set :deploy_to, 'development/myproject/'
#Default value for :scm is :git
#set :scm, :git
#Default value for :format is :pretty
#set :format, :pretty
# Default value for :log_level is :debug
set :log_level, :debug
#Default value for :pty is false
set :pty, true
# Default value for :linked_files is []
# set :linked_files, %w{config/database.yml}
# Default value for linked_dirs is []
set :linked_dirs, %w{media}
#tmp dir 
set :tmp_dir,"custom_tmp"
namespace :deploy do
  desc 'Restart application'
  task :restart do
    on roles(:app) do
      # Your restart mechanism here, for example:
      # execute :touch, release_path.join('tmp/restart.txt')
    end
  end
end

好了,我离成功又近了一步。我的tmp目录的路径不正确。我在服务器上执行了pwd操作,并将显示的路径放在"custom_tmp"前面,如:

设置:tmp_dir/客户/homeages/13/233232/custom_tmp"

但是根据repo文件夹的不同,cap分段部署会被一个新的错误中断:

fatal:目标路径'development/www.myproject.com/repo'已经存在,并且不是空目录。

我明白了。必须对…做同样的事情:设置:deploy_to

最新更新