Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open a TTY for interaction with git-push hooks?

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?

like image 789
ringe Avatar asked Nov 04 '22 19:11

ringe


1 Answers

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.

like image 114
ringe Avatar answered Nov 09 '22 09:11

ringe