You should have this in your deploy.rb to make sure ssh agent forwarding is on; 

ssh_options[:forward_agent] = true

You may also need to experiment with :pty particularly if the git server isn't 
in the known hosts. 

default_run_options[:pty] = true  # Must be set for the password prompt from 
git to work


You should make sure you are running an ssh agent; and it has the private key 
you expect to be loading. 

To see do:

ssh-add -l

You can sometimes also have issues if you are issuing git commands via sudo but 
you haven't added the following to sudoers:

Defaults    env_keep+=SSH_AUTH_SOCK

More info: 
http://help.github.com/deploy-with-capistrano/
http://serverfault.com/questions/107187/sudo-su-username-while-keeping-ssh-key-forwarding


On Oct 4, 2011, at 3:15 PM, Clemence Lelong <cleme...@heyrex.com> wrote:

> Hi,
> 
> I don't understand why I don't have the right permissions. 
> I am on debian lenny and I try a deploy php file with capistrano from github. 
> I have a good public key which is register on github, there is no problem to 
> execute git command, but when the cap command does it, it doesn't work.
> 
> Here is my Capfile :
> 
> load 'deploy' if respond_to?(:namespace) # cap2 differentiator
> Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
> set :scm_verbose, true
> 
> set :application, 'toto.com'
> set :use_sudo, false
> #set :home_path, "/var/www/toto.com"
> set :checkout, "export"
> set :deploy_to, "/var/www/#{application}"
> set :scm, "git"
> set :user, "deploy"
> set :scm_passphrase, "toto"
> set :repository, "g...@github.com:toto/toto.git"
> set :branch, "master"
> set :scm_password, "toto"
> role :web, "192.168.1.103"
> namespace :deploy do
>   task :restart do
>   end
> end
> 
> I have this on my terminal :
> deploy@tawa:/var/www/toto.com$ cap deploy
>   * executing `deploy'
>   * executing `deploy:update'
>  ** transaction: start
>   * executing `deploy:update_code'
>     executing locally: "git ls-remote g...@github.com:toto/toto.git master"
> Enter passphrase for key '/home/deploy/.ssh/id_rsa': 
>     command finished in 9338ms
>   * executing "git clone g...@github.com:toto/toto.git 
> /var/www/toto.com/releases/20111004215644 && cd 
> /var/www/toto.com/releases/20111004215644 && git checkout -b deploy 
> 3964e66788152850c424d0db9ab && (echo 3964e66788152850c424d0db9ab > 
> /var/www/toto.com/releases/20111004215644/REVISION)"
>     servers: ["192.168.1.103"]
> Password: 
>     [192.168.1.103] executing command
>  ** [192.168.1.103 :: err] Permission denied (publickey).
>  ** [192.168.1.103 :: err] fatal: The remote end hung up unexpectedly
>  ** [192.168.1.103 :: out] Initialized empty Git repository in 
> /var/www/toto.com/releases/20111004215644/.git/
>     command finished in 2959ms
> *** [deploy:update_code] rolling back
>   * executing "rm -rf /var/www/toto.com/releases/20111004215644; true"
>     servers: ["192.168.1.103"]
>     [192.168.1.103] executing command
>     command finished in 9ms
> failed: "sh -c 'git clone g...@github.com:toto/toto.git 
> /var/www/toto.com/releases/20111004215644 && cd 
> /var/www/toto.com/releases/20111004215644 && git checkout -b deploy 
> 3964e66788152850c424d0db9ab& (echo 3964e66788152850c424d0db9ab > 
> /var/www/toto.com/releases/20111004215644/REVISION)'" on 192.168.1.103
> 
> if I execute this command sh -c git.... it works!
> 
> Could you help me? maybe I don't have good rights for my user... 
> -- 
> * You received this message because you are subscribed to the Google Groups 
> "Capistrano" group.
> * To post to this group, send email to capistrano@googlegroups.com
> * To unsubscribe from this group, send email to 
> capistrano+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/capistrano?hl=en

-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to capistrano@googlegroups.com
* To unsubscribe from this group, send email to 
capistrano+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en

Reply via email to