【问题标题】:How can I open a TTY for interaction with git-push hooks?如何打开 TTY 以与 git-push 挂钩进行交互?
【发布时间】:2012-07-26 01:47:36
【问题描述】:

我正在使用 git-deploy Ruby gem 将应用程序交付到登台服务器。使用 SSH 密钥执行部署。

在我的after_push 脚本中,我想用sudo 运行一个命令,该命令随后会询问我的密码,因为 sudo 权限是有限的(没有密码就无法运行 sudo)。

实际上我的 sudo 命令失败了:

sudo: no tty present and no askpass program specified

我已经尝试添加一个 askpass 程序并根据 git 手册指定它。

如何在 git-push 进程中打开 TTY 以在我的 after_push 脚本中执行交互式命令?

【问题讨论】:

    标签: ssh githooks git-push post-commit


    【解决方案1】:

    到目前为止,我所寻求的似乎是不可能的。没有可用的 tty,这是我从阅读 Query on setting up a pre-receive hook in gitIs it possible to accept user input as part of a remote git post-receive hook? 中收集到的信息

    关于如何在 post-receive 中执行受密码保护的 sudo 操作有什么更好的建议吗?

    更新:答案在How do I prompt the user from within a commit-msg hook?

    我在这里尝试实现的目标是不可能的。

    【讨论】:

    • 我想要在服务器上执行一些设置,类似于我可以使用 Capistrano 执行的操作,但我没有找到执行此操作的方法。
    猜你喜欢
    • 1970-01-01
    • 2012-06-10
    • 1970-01-01
    • 2015-09-10
    • 1970-01-01
    • 2021-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多