Cap 3 and shell issues (git no such file or directory)

1,000 views
Skip to first unread message

npatil

unread,
Feb 14, 2014, 10:38:04 AM2/14/14
to capis...@googlegroups.com

Hi all, 
I've had Cap 3 based deployment working fine on a different rails project/env some months ago. 

But I'm running into an issue in a new rails project / env and look for some help.
The git command works fine via ssh but not via Capistrano. (See logs below).
I suspect this is related to the default behavior - non-interactive, non-login shell.
I've read through this link. 

Some workarounds/hacks, I've tried:

#set :default_shell, "bash -l"

#set :pty, true

set :default_env, { path: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }


Any suggestions most appreciate.

Thanks.

Versions:
  • Ruby 2.0.0
  • Capistrano 3.0.1
  • Rake / Rails / etc 4.0.0
Platform:
  • Working on - Mac OS X
  • Deploying to - Ubuntu
Logs:

INFO [a83ebb49] Running /usr/bin/env mkdir -p /tmp/ich_mvp/ on dev-ich-db.myhost.com
DEBUG [a83ebb49] Command: ( PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /usr/bin/env mkdir -p /tmp/ich_mvp/ )
 INFO [d1c6b4e8] Running /usr/bin/env mkdir -p /tmp/ich_mvp/ on dev-ich.myhost.com
DEBUG [d1c6b4e8] Command: ( PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /usr/bin/env mkdir -p /tmp/ich_mvp/ )
 INFO [a83ebb49] Finished in 1.685 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/ich_mvp/git-ssh.sh 0.0%
 INFO Uploading /tmp/ich_mvp/git-ssh.sh 100.0%
 INFO [d1c6b4e8] Finished in 2.134 seconds with exit status 0 (successful).
 INFO [d6bebce4] Running /usr/bin/env chmod +x /tmp/ich_mvp/git-ssh.sh on dev-ich-db.myhost.com
DEBUG [d6bebce4] Command: ( PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /usr/bin/env chmod +x /tmp/ich_mvp/git-ssh.sh )
 INFO [d6bebce4] Finished in 0.185 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/ich_mvp/git-ssh.sh 0.0%
 INFO Uploading /tmp/ich_mvp/git-ssh.sh 100.0%
 INFO [2a7f6a71] Running /usr/bin/env chmod +x /tmp/ich_mvp/git-ssh.sh on dev-ich.myhost.com
DEBUG [2a7f6a71] Command: ( PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /usr/bin/env chmod +x /tmp/ich_mvp/git-ssh.sh )
 INFO [2a7f6a71] Finished in 0.488 seconds with exit status 0 (successful).
DEBUG [d6bfd978] Running /usr/bin/env git ls-remote g...@git.myhost.com:ich/ich_mvp.git on dev-ich-db.myhost.com
DEBUG [d6bfd978] Command: ( PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/ich_mvp/git-ssh.sh /usr/bin/env git ls-remote g...@git.myhost.com:ich/ich_mvp.git )
DEBUG [2010547d] Running /usr/bin/env git ls-remote g...@git.myhost.com:ich/ich_mvp.git on dev-ich.myhost.com
DEBUG [2010547d] Command: ( PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/ich_mvp/git-ssh.sh /usr/bin/env git ls-remote g...@git.myhost.com:ich/ich_mvp.git )
DEBUG [d6bfd978] /usr/bin/env: git
DEBUG [d6bfd978] : No such file or directory
DEBUG [d6bfd978] Finished in 0.182 seconds with exit status 127 (failed).


Lee Hambley

unread,
Feb 14, 2014, 12:41:17 PM2/14/14
to capistrano
​Git isn't installed (or is installed, and not on the PATH) of the server:

DEBUG [d6bfd978]  /usr/bin/env: git
DEBUG [d6bfd978]  : No such file or directory

--
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/c2d4d393-f794-4805-ab61-ecd4d826ad64%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

npatil

unread,
Feb 14, 2014, 2:35:42 PM2/14/14
to capis...@googlegroups.com

Git is definitely installed on the server and in the PATH. It is in /usr/bin. 
I can also run a command such as below -
ssh -i <my key> m...@myhost.com 'which git' 
and I get back a valid response. Same is true if I run 'git --version'

I've also tried to explicitly state the path but no luck.

Any suggestions on how I would go debugging this further ? Because I've run the same command via ssh and it runs fine returning me valid results after executing the git command.
i.e. 
ssh -i <my key> m...@myhost.com '/usr/bin/env git ls-remote g...@git.myhost.com:ich/ich_mvp.git'
works fine but not from within capistrano.

Lee Hambley

unread,
Feb 14, 2014, 3:29:02 PM2/14/14
to capistrano
And is Git in one of the PATHs listed in `set :default_env, { path: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }`?

npatil

unread,
Feb 16, 2014, 11:00:18 AM2/16/14
to capis...@googlegroups.com
Yes that is correct. Git is found in /usr/bin

ssh -i ~/.ssh/ich.pem ubu...@dev-ich.myhost.com 'which git'
/usr/bin/git
Reply all
Reply to author
Forward
0 new messages