2017-05-21 135 views
-1

我試圖從bash腳本運行「git pull-request ...」。 執行時,它會提示輸入用戶名&的密碼。 如何從腳本本身自動回答該問題?自動回答bash腳本提示

謝謝。

更新: 最終我用@ eric-renouf建議的期望值。 這解決了我的問題。

+1

我不知道,如果你可以只設置配置信息,以防止提示,但如果沒有這很可能是一個工作,'expect' –

+0

你能給我怎麼做,用一個例子「期望」? – Pini

+2

顯然,有一個[API](https://developer.github.com/v3/pulls/#create-a-pull-request),所以你可以使用'curl'或者一個名爲'hub'的工具(見[this問題和答案](http://stackoverflow.com/questions/15302570/automatically-open-a-pull-request-on-github-by-command-line))對於'git'使用'expect'的例子,參見[這個問題](http://stackoverflow.com/questions/14092636/why-doesnt-my-git-auto-update-expect-script-work) –

回答

0

有喲,你嘗試過

git config credential.helper store 

或添加用戶名/密碼,您的網址是什麼?

https://user:[email protected]/repo 
+0

是的。不工作。 – Pini