2017-05-21 138 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