bash - Bash/Git - 提示用户输入密码
问题描述
我制作了一个 bash 脚本,可以自动将 git 提交到远程。但是,当它到达提交时,它不会将 SSH 密钥密码提示传递给用户,它只是退出。
这是脚本的相关部分!
set -e
[...]
read -p "Would you like to upload your app now? [y/n]: " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
git add *
git commit -m "Commit (Automated)"
git push cloud master
不是真正的 shell 脚本人,所以任何帮助将不胜感激!
编辑:澄清我希望提示用户在“git push ...”中输入密码
解决方案
解决了!看起来我脚本顶部的“set -e”是罪魁祸首。它将 git commit 命令“一切都是最新的”响应视为命令失败并退出。删除它解决了问题:D
推荐阅读
- java - 是否可以使用基类(非单例类)继承单例类。如果是,这是一个好习惯吗?
- chatbot - 使用 Botium 进行语音机器人测试
- java - 使用 selenium C# 自动分页
- makefile - 不会触发重新编译的 Makefile 依赖项?
- ag-grid - ag-grid & 符号在表中未正确显示
- computer-vision - Pytorch dataloader,线程太多,cpu内存分配太多
- ios - 如何在 Swift 5 中获取选定周的第一天
- python - 在图像预测中多次运行相同的代码获得相同的概率值
- reactjs - (React,Redux)当我将调度代码放入我的 onChange 函数时发生错误
- javascript - 如何在 React 中访问另一个 jsx 文件中的一个 jsx 文件的数据?