透過 ssh 使用 git 時不存在 tty 且未指定 Askpass 程序

透過 ssh 使用 git 時不存在 tty 且未指定 Askpass 程序

我試圖將 agit commit從我的筆記型電腦推送到我的伺服器,但不斷收到以下錯誤訊息:

remote: sudo: no tty present and no askpass program specified 
To ssh://[email protected]/~/site_hub

我的 sudoers 中有以下內容:

Defaults:git !requiretty
git ALL=(apache) NOPASSWD: /usr/bin/git

不知道為什麼我會收到該錯誤訊息。我用谷歌搜尋了一下,但沒有找到解決方案。

答案1

ssh 並不總是打開(偽)tty。這裡可能就是這種情況。 tty 分配可以透過以下方式強制執行:ssh -t甚至ssh -tt.如果您無法傳遞命令列參數,那麼您可以透過設定檔執行相同的操作:RequestTTY yes或者RequestTTY force,請參閱 man ssh_config。

相關內容