2011-10-13 141 views
0

我有這個deploy.rb文件:Capifony和Git裸回購

set :application, "UDA" 
set :domain,  "10.0.0.59" 
set :deploy_to, "/home/gitek/www/uda/" 
set :app_path, "app" 

set :user,  "gitek" 

ssh_options[:port] = 22 
set :php_bin, "/usr/bin/php" 

set :scm,   :git 
#set :git_enable_submodules, 1 
set :repository,    "#{domain}:/var/repos/uda.git" 
set :deploy_via,    :remote_cache 

# Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, `subversion` or `none` 

set :model_manager, "doctrine" 
# Or: `propel` 
role :web,  domain       # Your HTTP server, Apache/etc 
role :app,  domain       # This may be the same as your `Web` server 
role :db,   domain, :primary => true  # This is where Rails migrations will run 

set :keep_releases, 5 
set :use_sudo, false 

set :update_vendors, true 
ssh_options[:forward_agent] = true 


set :shared_files,  ["app/config/parameters.ini"] 
set :shared_children,  [app_path + "/logs", web_path + "/uploads", "vendor"] 

我的回購,是裸露的回購和它位於同一臺服務器,在「在/ var /回購/」。

的事實是,當我執行「上限部署」命令I'm收到此錯誤:

[email protected]/Applications/MAMP/htdocs/uda$ cap deploy 
    * executing `deploy' 
    * executing `deploy:update' 
** transaction: start 
    * executing `deploy:update_code' 
    updating the cached checkout on all servers 
    executing locally: "git ls-remote 10.0.0.59:/var/repos/uda.git HEAD" 
    command finished in 5487ms 
    * executing "if [ -d /home/gitek/www/uda/shared/cached-copy ]; then cd /home/gitek/www/uda/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 051be2de2155dfac7cfb45df0b4c2fb6ca633555 && git clean -q -d -x -f; else git clone -q 10.0.0.59:/var/repos/uda.git /home/gitek/www/uda/shared/cached-copy && cd /home/gitek/www/uda/shared/cached-copy && git checkout -q -b deploy 051be2de2155dfac7cfb45df0b4c2fb6ca633555; fi" 
    servers: ["10.0.0.59"] 
    [10.0.0.59] executing command 
** [10.0.0.59 :: err] Permission denied, please try again. 
** [10.0.0.59 :: err] Permission denied, please try again. 
** [10.0.0.59 :: err] Permission denied (publickey,password). 
** [10.0.0.59 :: err] fatal: The remote end hung up unexpectedly 
    command finished in 754ms 
*** [deploy:update_code] rolling back 
    * executing "rm -rf /home/gitek/www/uda/releases/20111013112554; true" 
    servers: ["10.0.0.59"] 
    [10.0.0.59] executing command 
    command finished in 20ms 
failed: "sh -c 'if [ -d /home/gitek/www/uda/shared/cached-copy ]; then cd /home/gitek/www/uda/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 051be2de2155dfac7cfb45df0b4c2fb6ca633555 && git clean -q -d -x -f; else git clone -q 10.0.0.59:/var/repos/uda.git /home/gitek/www/uda/shared/cached-copy && cd /home/gitek/www/uda/shared/cached-copy && git checkout -q -b deploy 051be2de2155dfac7cfb45df0b4c2fb6ca633555; fi'" on 10.0.0.59 
[email protected]/Applications/MAMP/htdocs/uda$ 

我認爲,問題就來了,因爲我的git回購是一個裸...

沒有人知道如何解決這個問題嗎?

在此先感謝

回答

0

更改您的deploy.rb,並設置這樣的倉庫:(?您的服務器10.0.0.59上)

set :repository, "ssh://[email protected]/var/repos/uda.git"

不要忘了添加到autorized_keys2

cat .ssh/id_rsa.pub | ssh [email protected] "cat >> .ssh/authorized_keys2"

希望能幫助到你。這個對我有用。

0

的問題是,您試圖訪問使用網絡和Git無法驗證服務器由於缺少SSH密鑰。

如果服務器在同一個部署機器上,使用遠程連接進行克隆沒有意義。通過傳遞存儲庫路徑來克隆本地存儲庫。

set :repository, "/var/repos/uda.git" 
+0

它不起作用,它說:「致命的:'/var/repos/uda.git'似乎不是一個git倉庫」 – ikerib

+0

你確定路徑是有效的嗎? 'cd'到'/ var/repos/uda.git'並執行'git status'來確保它是一個有效的存儲庫。 –

+0

ups!我得到這個錯誤:「gitek @ ubuntu:/var/repos/uda.git$ git status 致命的:這個操作必須在工作樹上運行」 – ikerib