git:wrapper task fails for unknown reason

909 views
Skip to first unread message

Douglas Magnenat

unread,
Jan 14, 2014, 6:04:16 AM1/14/14
to capis...@googlegroups.com
I got an issue with task git:wrapper not working :

Versions:
Ruby 2.1
Capistrano 3.0.1
Rake 10.1.1/ Rails 3.2.16 / etc

Platform:
Working on XUbuntu 12.04.4 LTS
Deploying to Debian Wheezy

Logs:
Please past logs (as completely as possible to a 3rd party pasting service such as pastie.org)
Which log do you want ? Capistrano has no log. Ruby has no log.

Files:

Capfile
require 'capistrano/setup'


require 'capistrano/deploy'


require 'capistrano/rails'


Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }


deploy.rb
require 'rvm/capistrano'
set :rvm_type, :system
set :application, 'odpf'
set :repo_url, 'g...@github.com:mycount/mygitrepo.git'
set :branch, 'production_1.01'

namespace :deploy do

  desc
'Restart application'
  task
:restart do
    on roles
(:app), in: :sequence, wait: 5 do
     
# Your restart mechanism here, for example:
     
# Reference : http://www.modrails.com/documentation/Users%20guide%20Apache.html#_redeploying_restarting_the_ruby_on_rails_application
      execute
:touch, release_path.join('tmp/restart.txt')
   
end
 
end

  after
:restart, :clear_cache do
    on roles
(:web), in: :groups, limit: 3, wait: 10 do
     
# Reference : http://guides.rubyonrails.org/v3.2.14/command_line.html#tmp
      within release_path
do
        execute
:rake, 'tmp:cache:clear'
     
end
   
end
 
end
  after
:finishing, 'deploy:cleanup'
end

Stage files (production.rb, staging.rb) :

production.rb
set :stage, :production
server
'myserver.net', user: 'rvm_admin', roles: %w{web app db}

set :ssh_options, {
  forward_agent
: false,
  port
: 8888
}


This my output :
douglas@bilbo:/var/www/odpf$ cap production git:check --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
 INFO
[01658950] Running /usr/bin/env mkdir -p /tmp/odpf/ on phisa-odpf-vd.vserver.nimag.net
DEBUG
[01658950] Command: /usr/bin/env mkdir -p /tmp/odpf/
DEBUG
[01658950]    === Lancement de /home/rvm_admin/.bashrc ===
 INFO
[01658950] Finished in 0.629 seconds with exit status 0 (successful).
cap aborted
!
=== Lancement de /home/rvm_admin/.bashrc ===
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-scp-1.1.2/lib/net/scp.rb:392:in `await_response_state'
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-scp-1.1.2/lib/net/scp.rb:363:in `
block (3 levels) in start_command'
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:311:in `call'

/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:311:in `process'
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:222:in `
block in preprocess'
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:222:in `each'

/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:222:in `preprocess'
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `
process'
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'

/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `
loop'
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:269:in `wait'

/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-scp-1.1.2/lib/net/scp.rb:279:in `upload!'
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:81:in `
upload!'
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/capistrano-3.0.1/lib/capistrano/tasks/git.rake:14:in `block (3 levels) in <top (required)>'

/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `
run'
/home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'

Tasks: TOP => git:check => git:wrapper

The last line of code that the ruby debugger gave is about await_response_state, so I guess that net-scp doesn't get an answer and timed out. I can't figure why though ???

I dug into /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/capistrano-3.0.1/lib/capistrano/tasks/git.rake and found this at the stucked line 13 :

upload! StringIO.new("#!/bin/sh -e\nexec /usr/bin/ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no \"$@\"\n"), "#{fetch(:tmp_dir)}/#{fetch(:application)}/git-ssh.sh"


I can nto figure out why this simple file creation fail. My /tmp dir got 777 access right.
I also dug into /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-scp-1.1.2/lib/net/scp.rb around line 392 :
# The action invoked while the state machine remains in the "await
# response" state. As long as there is no data ready to process, the
# machine will remain in this state. As soon as the server replies with
# an integer 0 as the only byte, the state machine is kicked into the
# next state (see +await_response+). If the response is not a 0, an
# exception is raised.
389>def await_response_state(channel)
390>  return if channel[:buffer].available == 0
391>  c = channel[:buffer].read_byte
392>  raise "#{c.chr}#{channel[:buffer].read}" if c != 0
393>  channel[:next], channel[:state] = nil, channel[:next]
394>  send("#{channel[:state]}_state", channel)
395>end


Lee Hambley

unread,
Jan 14, 2014, 6:16:47 AM1/14/14
to capistrano
First up, try this: http://capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/ Some of the content towards the end of that page is important.

The output === Lancement de /home/rvm_admin/.bashrc === indicates that you have something loading, which shouldn't. We have always recommended against using a pty especially as we can't guarantee what happen in those scripts, and how it might break your environment in the scripting context.

If you don't want to use a PTY (see below, for why you need the workaround) simply add set(:pty, false) somewhere early in your code. Along with the other set() lines is early enough.

It looks like you are using a version of Capistrano which still defaulted to using a pty by default (a mistake on our side) I suggest you try upgrading, and using Capistrano from master until we throw out the new release which certainly has that corrected, although any revision after 3.0.1 (from the Git history) should be fine.

I can't explain why your ssh session is timing out, but whatever your .bashrc is doing is certainly not helping.

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/70ad39fc-df36-4db4-9940-99efd9f0745b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Douglas Magnenat

unread,
Jan 14, 2014, 3:19:47 PM1/14/14
to capis...@googlegroups.com
Thanks for your answer.
Well, my '~/.bashrc' file is the standard default one. I just added an 'echo' command in order for me to be informed when this file is launched (That's usefull indeed !).

Simple question : How the capistrano's community would know that Capistran's current release 3.0.1 doesnt deactivate PTY by default when the official doc (the link you gave) and the readme https://github.com/capistrano/capistrano/blob/master/README.md clearly stated that it does ?
Moreover the Changelog https://github.com/capistrano/capistrano/blob/master/CHANGELOG.md doesn't says anything about a change with pty default value.

I also notice that the 'deploy_to' variable defaulted to /var/www, instead of /var/www/#{fetch(:application)}. Maybe this is a desired working, I don't know.
At least, I know I will never anymore rely on default settings ;o)

This is my new deploy.rb :
require 'rvm/capistrano'
set :rvm_type, :system

set :application, 'odpf'
set :repo_url, 'g...@github.com:mycount/mygitrepo.git'
set :branch, 'production_1.01'
set :deploy_to, '/var/www/odpf'
set :pty, false
set :scm, :git
set :format, :pretty

namespace :deploy do

  desc
'Restart application'
  task
:restart do
    on roles
(:app), in: :sequence, wait: 5 do
     
# Your restart mechanism here, for example:

      execute
:touch, release_path.join('tmp/restart.txt')
   
end
 
end

  after
:restart, :clear_cache do
    on roles
(:web), in: :groups, limit: 3, wait: 10 do
     
# Reference : http://guides.rubyonrails.org/v3.2.14/command_line.html#tmp
      within release_path
do
        execute
:rake, 'tmp:cache:clear'
     
end
   
end
 
end

  after
:finishing, 'deploy:cleanup'
end

So I tried to set(:pty, false) with Capistrano 3.0.1.
I also tried with master branch Capitrano 3.1.0.
In both case Capistrano "seems" to be running a non-login interactive connexion because my echo command still appear in the capistrano output (so ~/.bahsrc file is read). I can't figure ot why.


    desc "Check if ssh connexion is interactive"
    task
:query_interactive do
      on roles
(:all) do |host|
        info capture
("[[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive'") + " on #{host}"
     
end
   
end


    desc
"Check if ssh connexion is Login shell"
    task
:query_login do
      on roles
(:all) do |host|
        info capture
("shopt -q login_shell && echo 'Login shell' || echo 'Not login shell'")  + " on #{host}"
     
end
   
end

The result is that it is : Not Interactive and Not login shell though ~/.bashrc is read each time ! ^^

douglas@bilbo:/var/www/odpf$ bundle exec cap production test_odpf:query_login
DEBUG
[92119b95] Running /usr/bin/env shopt -q login_shell && echo 'Login shell' || echo 'Not login shell' on phisa-odpf-vd.vserver.nimag.net
DEBUG
[92119b95] Command: shopt -q login_shell && echo 'Login shell' || echo 'Not login shell'
DEBUG
[92119b95] === Lancement de /home/rvm_admin/.bashrc ===
DEBUG
[92119b95] Not login shell
DEBUG
[92119b95] Finished in 0.638 seconds with exit status 0 (successful).
 INFO
=== Lancement de /home/rvm_admin/.bashrc ===
Not login shell on myserver.net
douglas@bilbo
:/var/www/odpf$
douglas@bilbo
:/var/www/odpf$ bundle exec cap production test_odpf:query_interactive
DEBUG
[1275aad9] Running /usr/bin/env [[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive' on phisa-odpf-vd.vserver.nimag.net
DEBUG
[1275aad9] Command: [[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive'
DEBUG
[1275aad9] Finished in 0.617 seconds with exit status 0 (successful).
DEBUG
[1275aad9] === Lancement de /home/rvm_admin/.bashrc ===
DEBUG
[1275aad9] Not interactive
DEBUG
[1275aad9] Finished in 0.617 seconds with exit status 0 (successful).
 INFO
=== Lancement de /home/rvm_admin/.bashrc ===
Not interactive on myserver.net

There is something weird going on here and I don't know why ???

Lee Hambley

unread,
Jan 15, 2014, 3:10:41 AM1/15/14
to capistrano
It might be that some of the non-login, non-interactive dotfiles are loading your interactive, or login dotfiles. Some operating systems do this, they shouldn't. Are you deploying to somewhere exotic?
--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.

Douglas Magnenat

unread,
Jan 15, 2014, 5:04:41 AM1/15/14
to capis...@googlegroups.com
My server is a standard Debian :

rvm_admin@myserver.net:~$ cat /etc/debian_version
7.3


I looked into the man page of bash and it says this :

Bash attempts to determine when it is being run with its standard input connected to a network connection, as  when
       executed by the remote shell daemon, usually rshd, or the secure shell daemon sshd.  If bash determines it is being
       run in this fashion, it reads and executes commands from ~/.bashrc and ~/.bashrc, if  these  files  exist  and  are
       readable.   It  will not do this if invoked as sh.  The --norc option may be used to inhibit this behavior, and the
       --rcfile option may be used to force another file to be read, but rshd does not generally  invoke  the  shell  with
       those options or allow them to be specified.

I added some echo commands to my .bashrc to do some checks :

This is the begining of my /home/rvm_admin/.bashrc file :

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# These are my echo command checks
echo
'=== Execution of /home/rvm_admin/.bashrc ==='

[[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive'

shopt
-q login_shell && echo 'Login shell' || echo 'Not login shell'

echo
"Agent forwarding ? => SSH_AUTH_SOCK = $SSH_AUTH_SOCK"
echo
'=== End of echo commands by Douglas ==='


# If not running interactively, don't do anything
case $- in
   
*i*) ;;
     
*) return;;
esac


...

As you can see the original standard .bashrc file will do nothing if the shell is a non-intercative one.

I made two more tests :
1 - standard login ssh connection
2 - execute a custom capistrano's task

Here it is the output of my first test :

=== Lancement du script /etc/profile.d/rvm.sh ===
=== Execution of /home/rvm_admin/.bashrc ===
Interactive
Login shell
Agent forwarding ? => SSH_AUTH_SOCK = /tmp/ssh-KayxUr7HFP/agent.12938
=== End of echo commands by Douglas ===

 Here is the custom capistrano's task I execute :

    desc "Check if agent forwarding is working"
    task
:forwarding do

      on roles
(:all) do |h|

       
if test("env | grep SSH_AUTH_SOCK")
          info
"Agent forwarding is up to #{h}"
       
else
          error
"Agent forwarding is NOT up to #{h}"
       
end
     
end
   
end

Here it is the output I got :

douglas@bilbo:/var/www/odpf$ bundle exec cap production test_odpf:forwarding
DEBUG
[592e7884] Running /usr/bin/env env | grep SSH_AUTH_SOCK on myserver.net
DEBUG
[592e7884] Command: env | grep SSH_AUTH_SOCK
DEBUG
[592e7884] === Execution of /home/rvm_admin/.bashrc ===
DEBUG
[592e7884] Not interactive
DEBUG
[592e7884] Not login shell
DEBUG
[592e7884] Agent forwarding ? => SSH_AUTH_SOCK =
DEBUG
[592e7884] === End of echo commands by Douglas ===
DEBUG
[592e7884] Finished in 0.612 seconds with exit status 1 (failed).
ERROR
Agent forwarding is NOT up to myserver.net

At least I can see that agent forwarding is not working when I run a capistrano's task.
Though if I perform this test,  it works :

douglas@bilbo:/var/www/odpf$ ssh -p 8888 -A rvm_admin@myserver.net 'git ls-remote g...@github.com:mycount/myapp.git'
Host key fingerprint is 83:50:33:be:08:34:e6:f4:00:68:ac:57:d0:74:c0:a8
+--[ RSA 2048]----+
|       .X=C..    |
|      o  .+..    |
|     D ...OE     |
|      o....*     |
|      ..S = .    |
|       . - .     |
|        . .      |
|                 |
|                 |
+-----------------+


=== Execution of /home/rvm_admin/.bashrc ===
Not interactive
Not login shell
Agent forwarding ? => SSH_AUTH_SOCK = /tmp/ssh-dJ9dOKEhxE/agent.13224
=== End of echo commands by Douglas ===
e415894551dc656f79e95cdf3051223123553d40 HEAD
d872b0402c015ee40ac469e24ac78c1cffd6b8c4 refs
/heads/xxxxxx
6a0f8618f17aabbe1e801be9f9a57f55dd84f6b4 refs/heads/xxxxxx
a81b96a9362ad28bd3aef3d6014e6e6791ee3a6c refs
/heads/xxxxxx
0d097d9f87f8516bfec3985b6c8b1b5ed011c7b2 refs/heads/xxxxxx
0116b9fd3cd8b38e932832baf68f926be2513618 refs/heads/xxxxxx
e415894551dc656f79e95cdf3051223123553d40 refs
/heads/xxxxxx
dafa8fd1c86426b2ced0f4a47c9bc7e8172540f8 refs
/heads/xxxxxx
e33a87233763e7b4a1deb3c552fe02cbe18f3501 refs
/heads/xxxxxx
696a9f5f79e01f1c1e0f29b6f8cb512519b489f1 refs/heads/xxxxxx
f337186b34723b3b9d1beb71f16161086ea30f44 refs
/heads/xxxxxx
e415894551dc656f79e95cdf3051223123553d40 refs
/heads/xxxxxx
e3d0196766ffacccce698817dfee4fea17f0ed9f refs
/heads/xxxxxx
1e4c3c504a64699d8518ab67bca8f67e3bbcab51 refs/heads/xxxxxx
700ab704ec38a99fea44b013ccac97eb9168b866 refs/heads/xxxxxx
09496198b4dc93cffeaf7137c8f94aafa36e7148 refs/heads/xxxxxx

I don't understand why the agent-forwarding works in one case, but not with capistrano ?


Lee Hambley

unread,
Jan 16, 2014, 3:41:23 AM1/16/14
to capistrano
Douglas, I'm just not sure how to help you. How about a 1:1 to find out what is broken?

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.

Douglas Magnenat

unread,
Jan 16, 2014, 5:21:59 AM1/16/14
to capis...@googlegroups.com
I made more tests :

I created this task :

    desc "Display env variables"
    task
:display_env do

      on roles
(:all) do |h|

        test
"env"
     
end
   
end

Output :

bundle exec cap production test_odpf:display_env
DEBUG
[43cb0660] Running /usr/bin/env env on myserver.net
DEBUG
[43cb0660] Command: /usr/bin/env env
Text will be echoed in the clear. Please install the HighLine or Termios libraries to suppress echoed text.
Enter passphrase for /home/douglas/.ssh/id_rsa:
DEBUG
[43cb0660] === Execution of /home/rvm_admin/.bashrc ===
DEBUG
[43cb0660] Not interactive
DEBUG
[43cb0660] Not login shell
DEBUG
[43cb0660] Agent forwarding ? => SSH_AUTH_SOCK =
DEBUG
[43cb0660] === End of echo commands by Douglas ===
DEBUG
[43cb0660] Finished in 14.070 seconds with exit status 0 (successful).
DEBUG
[43cb0660] SHELL=/bin/bash
DEBUG
[43cb0660] SSH_CLIENT=212.41.220.177 37118 7001
DEBUG
[43cb0660] USER=rvm_admin
DEBUG
[43cb0660] MAIL=/var/mail/rvm_admin
DEBUG
[43cb0660] PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
DEBUG
[43cb0660] PWD=/home/rvm_admin
DEBUG
[43cb0660] LANG=fr_CH.UTF-8
DEBUG
[43cb0660] SHLVL=1
DEBUG
[43cb0660] HOME=/home/rvm_admin
DEBUG
[43cb0660] LANGUAGE=fr_CH:fr
DEBUG
[43cb0660] LOGNAME=rvm_admin
DEBUG
[43cb0660] SSH_CONNECTION=my_ip 37118 server_ip ssh_prot
DEBUG
[43cb0660] _=/usr/bin/env
DEBUG
[43cb0660] Finished in 14.070 seconds with exit status 0 (successful).


So if SSH_AUTH_SOCK env variable is lost maybe that is why scp is not possible. If the server lose trace of the ssh connexion, maybe this affect the scp ???

Maybe we should preserve environnement variable ? I m'not a bash expert though.
Could it be a track to follow ?

Douglas Magnenat

unread,
Jan 17, 2014, 3:49:12 AM1/17/14
to capis...@googlegroups.com
Ok I solved the scp issue and got a bit far away but it is still failing get:check capistrano's task.
I managed to test scp command solo on the bash and it was failing. That was weird because it was working at some point in the past.
I searched in google and found the solution.

The cause of all my problem was coming from a bug of scp that DEVELOPPERS REFUSE TO FIX !!! I can't believe it ! I spent weeks of search because of this....

Here it is an inquiry made by somone else on the same problem : http://unix.stackexchange.com/questions/18231/scp-fails-without-error
And here it is the SCP bug dating from year 2000 !!! https://bugzilla.redhat.com/show_bug.cgi?id=20527


To solve it, I commented my "echo commands" from my .bahsrc file :

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# These are my echo command checks
#echo '=== Execution of /home/rvm_admin/.bashrc ==='
#[[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive'
#shopt -q login_shell && echo 'Login shell' || echo 'Not login shell'#echo "Agent forwarding ? => SSH_AUTH_SOCK = $SSH_AUTH_SOCK"
#echo '=== End of echo commands by Douglas ==='


# If not running interactively, don't do anything
case $- in
 
*i*) ;;
 
*) return;;
esac

...

And scp get successfully executed :

douglas@bilbo:/var/www/odpf$ cap production git:check --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:
wrapper
 INFO
[bfe4332e] Running /usr/bin/env mkdir -p /tmp/odpf/ on myserver.net
DEBUG
[bfe4332e] Command: /usr/bin/env mkdir -p /tmp/odpf/
 INFO
[bfe4332e] Finished in 0.555 seconds with exit status 0 (successful).
DEBUG
Uploading /tmp/odpf/git-ssh.sh 0.0%
 INFO
Uploading /tmp/odpf/git-ssh.sh 100.0%
 INFO
[8763305f] Running /usr/bin/env chmod +x /tmp/odpf/git-ssh.sh on myserver.net
DEBUG
[8763305f] Command: /usr/bin/env chmod +x /tmp/odpf/git-ssh.sh
 INFO
[8763305f] Finished in 0.072 seconds with exit status 0 (successful).
** Execute git:check
DEBUG
[bfda396c] Running /usr/bin/env git ls-remote git@github.com:mycount/myrepo.git on myserver.net
DEBUG
[bfda396c] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/odpf/git-ssh.sh /usr/bin/env git ls-remote git@github.com:mycount/myrepo.git )
DEBUG
[bfda396c] Permission denied (publickey).
DEBUG
[bfda396c] fatal: The remote end hung up unexpectedly
DEBUG
[bfda396c] Finished in 1.135 seconds with exit status 128 (failed).


I think this is link to agent-forwarding SSH_AUTH_SOCK environnement variable not exported/set during capistrano's task.
Could it be because capistrano use some ssh option that prevent environnement variables ?
I dont know... I'm searching

Douglas Magnenat

unread,
Jan 19, 2014, 9:15:47 AM1/19/14
to capis...@googlegroups.com
My fault !

During all my tests, at some point, I set-up forward_agent option to false and forgot to put it back to true in my ./config/deploy/production.rb :

set :ssh_options, { forward_agent: true, port: 8888 }

Capistrano's task 
cap production git:check --trace
is now working !!!

More over I noticed during the last check of my capistrano files that I was using wrong rvm-adaptator gem for capistrano 3.x in my Capfile:

# For Capistrano 2.x
require 'rvm/capistrano'

So I changed it for this :

# For Capistrano 3.x
require 'capistrano/rvm'

Thanks for your help on this.
I hope this thread will other people having problem with ssh access in git:check Capistrano's task ^^

Cheers,
Douglas
Reply all
Reply to author
Forward
0 new messages