Git Portable-警告终端功能不完整 [英] Git Portable - WARNING terminal is not fully functional
问题描述
某些命令(例如git log
)会在屏幕上产生预期的输出之前导致令人讨厌的错误消息.错误消息看起来像这样:
Certain commands, such as git log
result in an annoying error message before the expected output is produced on screen. The error message looks like this:
C:\CNC>git log
WARNING: terminal is not fully functional
- (press RETURN)commit 5d2076175b...
现在让我将这个问题与类似的问题区分开,并展示我已经尝试过的内容.
Now let me differentiate this question from similar questions and show what I've already tried.
-
我在Windows上使用git Portable;版本2.22.0.windows.1
I'm using git portable on Windows; version 2.22.0.windows.1
Windows 10版本10.17763
Windows 10, Version 10.17763
我不使用git-bash,因此出于这个问题,假设这是不可能的.我专门要求使用git-cmd.exe解决方案.
I'm not using git-bash and for the sake of this question, assume it is not possible. I am specifically asking for a solution with git-cmd.exe.
我的计算机上没有管理员权限.其他问题使人们设置环境变量set TERM=msys
.我可以在用户个人资料下执行此操作,但不能在系统级别上执行此操作.我已经在用户级别设置了TERM,但是它不能解决问题.
I do not have admin access on my machine. Other questions have people setting an environment variable set TERM=msys
. I can do this under my user profile, but not at the system level. I have set TERM at the user level, but it doesn't solve the problem.
推荐答案
我只使用Git便携式版本,没有看到此问题.
I only use the Git portable edition, and do not see this issue.
vonc@VONCA D:\git
> git version
git version 2.21.0.windows.1
我确实在2014年推荐了set TERM=msys
,但如今(2019年)不需要.
I did recommended set TERM=msys
in 2014, but that should not be needed nowadays (2019).
在常规CMD会话的简化PATH中使用Git时,检查问题是否仍然存在:
Check if the issue persists when using Git in a simplified PATH in your regular CMD session:
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
set GIT_HOME=C:\Path\to\Git
set PATH=%GIT_HOME%;%GIT_HOME%\bin;%GIT_HOME%\usr\bin;%GIT_HOME%\mingw64\bin;%PATH%
git log
git-for-windows/git
issue 1572 mentions:
警告消息不是来自
git
,而是来自less
,它被git
用作默认寻呼机.
The warning message is not from
git
, but fromless
, which is used as the default pager bygit
.
如果将less -d
指定为pager
,则不会对您的终端发出警告:
If you specify less -d
as pager
, less will not warn about your terminal:
$ less --help | grep -A 1 dumb
-d ........ --dumb
Dumb terminal.
您可以使用以下命令进行配置:
git config --global core.pager "less -d"
您还可以使用:git config --global core.pager "TERM=cygwin less"
.
这将为您提供功能更强大的寻呼机.
you can also use: git config --global core.pager "TERM=cygwin less"
.
This will give you a more functional pager.
另一种解决方案是创建一个批处理文件:
Yet another solution is to create a batch file:
$ cat less.bat
@set TERM=
@less.exe %*
并将其用作您的寻呼机:
And use it as your pager:
git config --global core.pager "/c/path/to/batch/less.bat".
这篇关于Git Portable-警告终端功能不完整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!