2014-06-19 23 views
5

虽然在Ubuntu 14.04中部署与Capistrano的一个Rails应用程序,我收到以下错误:Capistrano的目标路径已经存在,不是一个空目录

fatal: destination path '/var/www/APP-NAME/repo' already exists and is not an empty directory. 


cf5a389e] Running /usr/bin/env [ -f /var/www/rd/repo/HEAD ] on LINODE-INSTANCE-IP 
DEBUG[cf5a389e] Command: [ -f /var/www/rd/repo/HEAD ] 
DEBUG[cf5a389e] Finished in 0.005 seconds with exit status 1 (failed). 
DEBUG[8899b95c] Running /usr/bin/env if test ! -d /var/www/rd; then echo "Directory does not exist '/var/www/rd'" 1>&2; false; fi on LINODE-INSTANCE-IP 
DEBUG[8899b95c] Command: if test ! -d /var/www/rd; then echo "Directory does not exist '/var/www/rd'" 1>&2; false; fi 
DEBUG[8899b95c] Finished in 0.005 seconds with exit status 0 (successful). 
INFO[fc5f524b] Running /usr/bin/env git clone --mirror GIT_REPO_URL /var/www/APP-NAME/repo on LINODE-INSTANCE-IP 
DEBUG[fc5f524b] Command: cd /var/www/APP-NAME && (GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/rd/git-ssh.sh /usr/bin/env git clone --mirror GIT-REPO-URL /var/www/APP-NAME/repo) 
DEBUG[fc5f524b] fatal: destination path '/var/www/APP-NAME/repo' already exists and is not an empty directory. 

下面是配置文件:

only reason这个错误我可以在网上找到;

same host in more than one role, so that they're racing? For example I mean that you might have the same IP address defined as an :app role host more than once.

我认为这不符合上述配置文件。

回答

11

我有同样的问题。原因在于角色和/或服务器的双重定义。 尝试删除

server 'SERVER-IP', user: 'USERNAME', roles: %w{app} 
在production.rb

role :app, "SERVER-IP" 

在deploy.rb。后者似乎只是简单的语法,而前者是扩展的,所以实际上你可以两次声明角色(三次更精确:production.rb中的两个,deploy.rb中的一个)。希望能帮助到你。

+0

谢谢@leger。我删除了上述2行,但仍然错误部署仍然存在。虽然我认为我现在走在了正确的轨道上,但在过去的3个小时里一直困在这里。 –

+3

尝试通过'rm -rf'删除服务器上的APP-NAME并重新部署。我以这种方式运行了所有迭代,直到最终成功完成部署。有时用'sudo reboot' :) – Leger

+0

Woah !!!最后。极乐。 :D –

相关问题