2014-06-19 22 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 –

相關問題