I am using the git-deploy Ruby gem to deliver an application to the staging server. The deployment is performed with SSH keys.
In my after_push
script I want to run a command with sudo
, which subsequently asks for my password, since sudo rights are limited (can't run sudo without password).
Effectively my sudo command fails with:
sudo: no tty present and no askpass program specified
I've tried adding an askpass program and specifying it according to the git manual.
How can I open a TTY in the git-push
process for interactive commands in my after_push
script?
So far it seems what I am seeking is not possible. There is no tty available, is what I gather from reading Query on setting up a pre-receive hook in git and Is it possible to accept user input as part of a remote git post-receive hook?
Any better suggestions for how to perform password protected sudo operations in post-receive?
UPDATE: The answer was found in How do I prompt the user from within a commit-msg hook?
It is not possible to do what I've tried to achieve here.