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

查看:31
本文介绍了即使操作成功,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.

观看视频

推荐答案

要解决此问题并继续使用 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天全站免登陆