在cronjob bash脚本期间git密码质询失败
我正在作为cron作业运行以下bash脚本:在cronjob bash脚本期间git密码质询失败,git,bash,cron,ubuntu-14.04,Git,Bash,Cron,Ubuntu 14.04,我正在作为cron作业运行以下bash脚本: #!/bin/bash gh[1]="https://github.com/myteam/myrepo1" gh[2]="https://github.com/myteam/myrepo2" gh[3]="https://github.com/myteam/myrepo3" for index in ${!gh[*]} do git clone ${gh[$index]} ./src
#!/bin/bash
gh[1]="https://github.com/myteam/myrepo1"
gh[2]="https://github.com/myteam/myrepo2"
gh[3]="https://github.com/myteam/myrepo3"
for index in ${!gh[*]}
do
git clone ${gh[$index]} ./src
done
一些回购协议不存在或受密码保护。我已经研究了几个选项:
a。升级git以利用新的git功能-git_TERMINAL_提示:在Ubuntu 14.04中升级git很困难,如果我可以避免,那会更好,因为我希望我的服务器是“标准的”(请参阅)
b。将https更改为ssh(例如git://)-我也不能这样做,因为我将获得https git位置的第三方列表
c。在Ubuntu中使用“yes”命令,例如
yes | git clone ....
这似乎不起作用
d。将随机字符串传递给git clone命令
echo " " | git clone
这似乎也不起作用
基本上,我想实现的是,如果git clone命令被询问密码,那么它就会失败并继续到下一个 您是否查看了expect?好吧,这看起来很有希望,但我可能缺乏真正理解这一点的技能。我还想继续而不是完全存在脚本。。。。我会再看一看,玩一玩,看看能不能想出点什么。。。。谢谢,非常感谢!