Git接收用户输入 [英] Git post-receive user input

查看:52
本文介绍了Git接收用户输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在git push origin master之后实现数据库导入,但是问题是我无法提示用户从Git中的 post-receive 挂钩输入. 我需要询问用户有关导入的信息,是否应该进行导入以及数据库导出文件的名称.

I am trying to implement a database import after a git push origin master, but the problem is I cannot prompt the user for input from post-receive hook in Git. I need to ask the user about the import, if it should happen and for the name of the database export file.

我在Google中找不到任何有用的信息.

I couldn't find any useful information in Google.

推荐答案

挂钩本身只能返回stdout/stderr,而不能等待stdin.

The hook itself can only return stdout/stderr, not wait for stdin.

一种方法是将指令与数据一起推送,以供挂钩使用.
另一个办法是在钩子知道要查找的位置时,分别在服务器上传达这些指令.

One way would be to push the instructions with the data, for the hook to use.
Another would be to communicate those instructions separately on the server, with the hook knowing where to look.

在这两种情况下,其想法都是获得一个自动化的过程,而不是一个交互式的过程.

In both cases, the idea is to get an automated process instead of an interactive one.

这篇关于Git接收用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆