2013-08-30 9 views
5

Ich versuche, meine Rails 4 App mit Capistrano mit einem Remote-Git Repository auf meinem Server zu implementieren. Mein git-Repo befindet sich auf demselben Server, auf dem ich meine App bereitstelle. Wann immer ich einen cap deploy versuche ich diesen FehlerWarum erhalte ich eine "Erlaubnis verweigert", wenn ich versuche, die Bereitstellung zu beschränken?

my/local/rails/app/directory$ cap deploy 
    triggering load callbacks 
    * 2013-08-30 15:51:20 executing `deploy' 
    * 2013-08-30 15:51:20 executing `deploy:update' 
** transaction: start 
    * 2013-08-30 15:51:20 executing `deploy:update_code' 
    updating the cached checkout on all servers 
    executing locally: "git ls-remote ssh://[email protected]/var/repos/test.git master" 
    command finished in 684ms 
    * executing "if [ -d /var/www/test/www/shared/cached-copy ]; then cd /var/www/test/www/shared/cached-copy && git fetch origin && git fetch --tags origin && git reset --hard 9de1df43a7959b953dc0b35c2ab27ba84698602a && git clean -d -x -f; else git clone -b master ssh://[email protected]/var/repos/test.git /var/www/test/www/shared/cached-copy && cd /var/www/test/www/shared/cached-copy && git checkout -b deploy 9de1df43a7959b953dc0b35c2ab27ba84698602a; fi" 
    servers: ["myserver.com"] 
    [myserver.com] executing command 
** [myserver.com :: out] Cloning into '/var/www/test/www/shared/cached-copy'... 
** [myserver.com :: out] 
** [myserver.com :: out] [email protected]'s password: 
Password: 
** [myserver.com :: out] 
** [myserver.com :: out] Permission denied, please try again. 
** [email protected]'s password: 
Password: 
** [myserver.com :: out] 
** [myserver.com :: out] Permission denied, please try again. 
** [email protected]'s password: 
Password: 
** [myserver.com :: out] 
** [myserver.com :: out] Permission denied (publickey,password). 
** fatal: Could not read from remote repository. 
** 
** Please make sure you have the correct access rights 
** and the repository exists. 
    command finished in 18891ms 
*** [deploy:update_code] rolling back 
    * executing "rm -rf /var/www/test/www/releases/20130830225140; true" 
    servers: ["myserver.com"] 
    [myserver.com] executing command 
    command finished in 700ms 
failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-2.0.0-p247' -c 'if [ -d /var/www/test/www/shared/cached-copy ]; then cd /var/www/test/www/shared/cached-copy && git fetch origin && git fetch --tags origin && git reset --hard 9de1df43a7959b953dc0b35c2ab27ba84698602a && git clean -d -x -f; else git clone -b master ssh://[email protected]/var/repos/test.git /var/www/test/www/shared/cached-copy && cd /var/www/test/www/shared/cached-copy && git checkout -b deploy 9de1df43a7959b953dc0b35c2ab27ba84698602a; fi'" on myserver.com 

Wann immer ich darin mein Passwort eingeben sagt verweigert die Erlaubnis, und ich bin sicher, ist das Passwort korrekt. Hier ist meine deploy.rb

require 'bundler/capistrano' 
require 'rvm/capistrano' 

set :user, 'user' 
set :domain, 'myserver.com' 
set :application, "blog" 
set :repository, "ssh://[email protected]/var/repos/test.git" 
set :scm_passphrase, "password" 
set :deploy_to, '/var/www/test/www' 
set :deploy_via, :remote_cache 
set :scm, :git 
set :branch, 'master' 
set :scm_verbose, true 
set :use_sudo, false 
set :normalize_asset_timestamps, false 
set :rails_env, :production 

set :rvm_type, :system 
set :rvm_ruby_string, 'ruby-2.0.0-p247' 
# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names 
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` 

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 

default_run_options[:pty] = true 
ssh_options[:forward_agent] = true 
after "deploy", "deploy:migrate", "deploy:restart" 
after "deploy:update", "deploy:restart" 

# if you want to clean up old releases on each deploy uncomment this: 
# after "deploy:restart", "deploy:cleanup" 

# if you're still using the script/reaper helper you will need 
# these http://github.com/rails/irs_process_scripts 

# If you are using Passenger mod_rails uncomment this: 
# namespace :deploy do 
# task :start do ; end 
# task :stop do ; end 
# task :restart, :roles => :app, :except => { :no_release => true } do 
#  run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" 
# end 
# end 

namespace :deploy do 
    desc "cause Passenger to restart" 
    task :restart do 
     run "touch #{current_path}/tmp/restart.txt" 
    end 
end 

Ich bin in der Lage mit einem SSH-Schlüssel in meinem Server über die Befehlszeile ssh, so das ist, funktioniert gut. Wer weiß, was das Problem ist? Vielen Dank.

Antwort

5

Das hat für mich in der Vergangenheit funktioniert. Hoffe es funktioniert für dich:

ssh-add /.ssh/id_rsa 
+0

Wo würde ich das hinstellen? – oobie11

+0

Versuchen Sie von der Maschine aus, den Repo zu klonen. Es tut aber nicht weh, es auf beiden zu tun. – kikuchiyo

+1

OH MEIN GOTT !!! Danke, ich habe tagelang damit zu kämpfen! Ich habe das auf meiner Entwicklungsmaschine ausgeführt. Was genau macht ssh_add/.shh/id_rsa? – oobie11

Verwandte Themen