Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git for Windows

Tags:

git

windows

I am a new user of Git for Windows. I have installed from Google Code (1.8.1.2, and 1.7 as a trial).

I can issue some git commands, and they are fine and work perfectly. However, the 'git diff' and 'git log' commands do not work. 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. The machine is Windows 7, very new build.

Could anyone help or give me diagnostic pointers as to why these two commands fail?

like image 480
Steve Hibbert Avatar asked Feb 25 '13 10:02

Steve Hibbert


3 Answers

It sounds like your .gitconfig file might not be setup correctly, or the environmental PATH is missing.

For folks that are new to git I almost always recommend that they first start with either

Git Hub for Windows (easiest for new folks)

or

Git Extensions (not sure if this is what you installed)

like image 200
Chadit Avatar answered Oct 03 '22 07:10

Chadit


In .gitconfig, the pager value was an empty string. 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. No idea how it happened.

like image 36
Steve Hibbert Avatar answered Oct 03 '22 06:10

Steve Hibbert


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)

Try and launch git-cmd.bat, or the git-bash shortcut, both included in the msysgit distribution.
They will complement the PATH and set HOME (which is very important, since Windows doesn't set HOME by default)

In those sessions (git-cmd or bash), git diff should work.

The actual solution was like the one in "msysGit: Why does git log output blank lines?": set the pager

[core] 
   pager = less -R
like image 45
VonC Avatar answered Oct 03 '22 08:10

VonC