简体   繁体   English

Git for Windows

[英]Git for Windows

I am a new user of Git for Windows. 我是Git for Windows的新用户。 I have installed from Google Code (1.8.1.2, and 1.7 as a trial). 我已经安装了Google Code(1.8.1.2和1.7作为试用版)。

I can issue some git commands, and they are fine and work perfectly. 我可以发出一些git命令,它们很好并且工作得很好。 However, the 'git diff' and 'git log' commands do not work. 但是,'git diff'和'git log'命令不起作用。 These commands both come back with 这些命令都回来了

'': : command not found

I have tried uninstalling and re-installing. 我尝试过卸载并重新安装。 I also have GitHub for Windows on my machine. 我的机器上也有GitHub for Windows。 The machine is Windows 7, very new build. 该机器是Windows 7,非常新的版本。

Could anyone help or give me diagnostic pointers as to why these two commands fail? 任何人都可以帮助或给我诊断指针,为什么这两个命令失败?

It sounds like your .gitconfig file might not be setup correctly, or the environmental PATH is missing. 听起来您的.gitconfig文件可能未正确设置,或者缺少环境PATH。

For folks that are new to git I almost always recommend that they first start with either 对于那些刚接触git的人,我几乎总是建议他们先从两者开始

Git Hub for Windows (easiest for new folks) 适用于Windows的Git Hub (对于新人来说最简单)

or 要么

Git Extensions (not sure if this is what you installed) Git Extensions (不确定这是否是你安装的)

Path too big to paste 路径太大,无法粘贴

Make sure your PATH is not too big or it might end up truncated, with strange side-effects (like, potentially, your error messages) 确保你的PATH不是太大或者它可能最终被截断,带有奇怪的副作用(比如,可能是你的错误信息)

Try and launch git-cmd.bat , or the git-bash shortcut , both included in the msysgit distribution . 尝试并启动msysgit发行版中包含的git-cmd.batgit-bash快捷方式
They will complement the PATH and set HOME (which is very important, since Windows doesn't set HOME by default) 它们将补充PATH并设置HOME (这非常重要,因为Windows默认情况下不设置HOME

In those sessions ( git-cmd or bash ), git diff should work. 在那些会话( git-cmdbash )中, git diff应该可以工作。

The actual solution was like the one in " msysGit: Why does git log output blank lines? ": set the pager 实际的解决方案就像“ msysGit:为什么git log输出空行? ”: 设置寻呼机

[core] 
   pager = less -R

In .gitconfig, the pager value was an empty string. 在.gitconfig中,寻呼机值为空字符串。 Any git command that pipes to a pager (ie git-diff or git-log) will fail with a command-not-found because DOS is being asked to run an empty string as a command. 管道到寻呼机的任何git命令(即git-diff或git-log)都会因命令未找到而失败,因为要求DOS将空字符串作为命令运行。 No idea how it happened. 不知道是怎么回事。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM