Capistrano "No tty present and no askpass program specified" Capistrano "No tty present and no askpass program specified" postgresql postgresql

Capistrano "No tty present and no askpass program specified"


One solution would be to allow the sudo command on your server without entering a password, but that could be a security risk.

Alternatively, you can fix your Capistrano configuration because something is likely wrong. It would help if you showed us the contents of your deploy.rb file but first thing I would do is ensure that you have default_run_options[:pty] set to true in deploy.rb. Or add the line if you're missing it.

Capistrano 2

default_run_options[:pty] = true

Capistrano 3

set :pty, true


On server open visudo file for editing:

sudo visudo

and list all commands that your deployment user is allowed to run without entering password, eg.:

deploy_user        ALL=(ALL) NOPASSWD: \  /bin/systemctl status puma_production, \  /bin/systemctl start puma_production, \  /bin/systemctl stop puma_production, \  /bin/systemctl restart puma_production

save the file and try to run capistrano command again. You could allow all commands by NOPASSWD:ALL but it's considered not safe ofc as for unprivileged user.

Note: ensure your executable path is full – eg. not systemctl but /bin/systemctl, which you can get by which systemctl command