即使操作成功,PowerShell也会在控制台中显示一些git命令结果作为错误 [英] PowerShell displays some git command results as error in console even though operation was successful

查看:260
本文介绍了即使操作成功,PowerShell也会在控制台中显示一些git命令结果作为错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在PowerShell中执行Git命令时,除了PowerShell控制台和NuGet控制台之间的一个细微差别之外,一切都很好。来自 git push 的输出在NuGet窗口中以红色错误文本显示,但在PowerShell窗口中显示正常。

When I execute Git commands in PowerShell everything is working great except one minor difference between the PowerShell console and the NuGet console. The output from a "git push" is displayed in red error text in the NuGet window but displays fine in the PowerShell window.

以下是一段视频,展示其中的差异。 git push 在包管理器控制台中将其结果显示为错误。该操作奏效,只是令人讨厌的是,该操作的输出显示为错误。

Here is a video showing the difference. "git push" displays its results as an error in the package manager console. The operation worked, it's just annoying that the output from the operation is displayed as an error.

观看视频

See the video

推荐答案

使用Powershell ISE,您可以创建包含以下内容的cmd文件:

To fix this and keep working with Powershell ISE you can create a cmd file with the following content:

@echo off
git.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 2>&1

并将其注册为别名(在您的个人资料中):

And register it as alias (inside your profile):

Set-Alias git "git.cmd"

这篇关于即使操作成功,PowerShell也会在控制台中显示一些git命令结果作为错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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