Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
执行git子模块时,MSBuild exec任务从未完成_Git_Msbuild_Git Submodules - Fatal编程技术网

执行git子模块时,MSBuild exec任务从未完成

执行git子模块时,MSBuild exec任务从未完成,git,msbuild,git-submodules,Git,Msbuild,Git Submodules,在git存储库中,我想通过MSBuild添加一个子模块。我假设下面这样的事情会允许我这样做 <Exec Command='git submodule add -f git@clone-url.git "sub/module/folder"' /> 我猜git在询问我的用户名和密码。由于某些原因,输出永远不会传递到主命令窗口,以便我可以输入存储库的用户名和密码 是否仍要查看它暂停或允许执行命令输出到主窗口的原因?以前有人试图让命令请求密码,但这很复杂,因为: 但是,与更具体的任务不同

在git存储库中,我想通过MSBuild添加一个子模块。我假设下面这样的事情会允许我这样做

<Exec Command='git submodule add -f git@clone-url.git "sub/module/folder"' />
我猜git在询问我的用户名和密码。由于某些原因,输出永远不会传递到主命令窗口,以便我可以输入存储库的用户名和密码


是否仍要查看它暂停或允许执行命令输出到主窗口的原因?

以前有人试图让命令请求密码,但这很复杂,因为:

但是,与更具体的任务不同,
Exec
任务无法从其运行的工具或命令收集输出


但是,请参见“”),如在
cmd/c git子模块中…
,以防该子模块起作用。

Exec
任务继承自
Microsoft.Build.Utilities.ToolTask
,该任务通过设计在创建时关闭输入流,例如,在Visual Studio下而不是在MSBuild下执行时,该任务没有输入

proc.Start();
proc.StandardInput.Close();
proc.BeginErrorReadLine();
proc.BeginOutputReadLine();
要“接受”输入,您必须在其中插入管道,或者让您自己的自定义/内联任务创建
进程
,或者使用
start
预先发送命令,以通过新的
cmd
窗口退出重定向


或者使用ssh密钥文件。

您可以尝试将命令放入批处理文件中,然后从Exec调用该文件。这似乎比我的答案更精确+1.
proc.Start();
proc.StandardInput.Close();
proc.BeginErrorReadLine();
proc.BeginOutputReadLine();