Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

capistrano: sudo error after after it had been working fine before

I recently started using capistrano in my rails application deployment. It was working fine for me and then all of a sudden, I started getting this error

sorry, you must have a tty to run sudo

after every gem it tried to install. I know this problem can typically be solved by putting in set :use_sudo, false in the deploy.rb file but I already have that in there. And the strangest thing is that I reverted my ENTIRE directory back to when I know for sure capistrano was working and it's still giving me the same error.

My server is running CentOS

So what could the problem possibly be caused by? Any ideas?

like image 902
yiinewbie Avatar asked Apr 26 '12 20:04

yiinewbie


2 Answers

You can tell cap to create a pty for each process, by adding this line:

default_run_options[:pty] = true

to Capfile

like image 132
nyaa Avatar answered Sep 22 '22 14:09

nyaa


For Capistrano 3 you need to add:

set :pty, true

to the file config/deploy.rb

like image 31
ajtrichards Avatar answered Sep 22 '22 14:09

ajtrichards