Windows中的Git命令行

时间:2021-08-26 01:23:13

标签:

Git command line for MS-Windows

Inhalt

Topic:.git.cmd.

.


1 Download and install, or copy the git command line suite for MS-Windows

Topic:.git.cmd.install.

You can download a git suite for command line processing from https://git-scm.com/download/win and install it. The installed files run on an other computer without installing. That may be important if you have experience with several git installations.

I have installed Git-2.9.3.2-32.bit.exe on a computer running under Windows-XP. I have answered all questions during the install process with the minimal influence to the operation system:

Select components: Deselect all! No icons, no Windows Explorer Integration, no change of file extension-associations.

No change of the system‘s PATH variable: Use Git from Git Bash only

Use OpenSSH

Configure the line ending conversions: Checkout as-is, commit-as-is: See TODO

Use MinTTY (the default terminal of MSYS2), don‘t select Use Windows‘ default console window

Enable file system chaching

I have select D:\Programs\Gitcmd as destination for installation. That is my tool folder.

This produces the following files (raw):

D:\Programs\Gitcmd>dir Directory of D:\Programs\Gitcmd 29.08.2016 11:50 <DIR> . 29.08.2016 11:50 <DIR> .. 29.08.2016 11:38 <DIR> bin 29.08.2016 11:38 <DIR> cmd 29.08.2016 11:38 <DIR> dev 29.08.2016 11:38 <DIR> etc 25.08.2016 13:47 151.272 git-bash.exe 25.08.2016 13:47 150.760 git-cmd.exe 09.08.2016 19:02 18.765 LICENSE.txt 29.08.2016 11:38 <DIR> mingw32 25.08.2016 15:06 77.551 ReleaseNotes.html 29.08.2016 11:38 <DIR> tmp 29.08.2016 11:38 996.808 unins000.dat 29.08.2016 11:34 1.293.032 unins000.exe 29.08.2016 11:38 22.815 unins000.msg 29.08.2016 11:38 <DIR> usr 7 File(s) 2.711.003 bytes 9 Dir(s) 83.736.236.032 bytes free

I have copied that file tree to a Windows-7-Computer, it runs perfect, without installation.

An older version of GitCmd gives the following files:

D:\Programs\Gitcmd_1608>dir Directory of D:\Programs\Gitcmd_1608 03.05.2015 13:29 <DIR> . 03.05.2015 13:29 <DIR> .. 25.08.2016 23:33 20 .bash_history 31.07.2014 19:55 <DIR> bin 31.07.2014 19:55 <DIR> cmd 31.07.2014 19:55 <DIR> doc 31.07.2014 19:55 <DIR> etc 04.02.2014 17:27 793 Git Bash.lnk 02.06.2013 12:30 708 Git Bash.vbs 31.07.2014 19:55 <DIR> lib 31.07.2014 19:55 <DIR> libexec 02.06.2013 12:30 38.203 ReleaseNotes.rtf 31.07.2014 19:56 <DIR> share 31.07.2014 19:56 <DIR> ssl 04.02.2014 17:26 566.105 unins000.dat 04.02.2014 17:25 1.243.915 unins000.exe 6 File(s) 1.849.744 bytes 10 Dir(s) 83.732.533.248 bytes free

There are some other directories, mingw3w is missing. Nevertheless it produces the adequate results. Both contains

D:\Programs\Gitcmd_1608\bin>dir sh.exe 04.02.2014 17:27 540.672 sh.exe D:\Programs\Gitcmd\bin>dir sh.exe 25.08.2016 13:47 43.240 sh.exe

There are some changes in the tool suite, but the behaviour for the usage is the same.


2 sh.exe

Topic:.git.cmd.sh.

The D:\Programs\Gitcmd ... \bin\sh.exe is a windows program to run linux shell scripts or linux commands.


2.1 pure run >sh.exe

Topic:.git.cmd.sh.pure.

Without any other action, only invoked from a Windows command line (double click in explorer), it opens a linux-like command window. That shell window gets the environment variables from MS-Windows and sets the path variable (slightly) properly. One can type in some linux commands, here is an example content of the shell window after some commands:

Hartmut(at)lenovo-a6f13ea5 MINGW32 /bin $ pwd /bin $ whoami Hartmut $ ls / -all total 4080 drwxr-xr-x 1 hartmut 197121 0 Aug 29 11:50 . drwxr-xr-x 1 hartmut 197121 0 Aug 29 11:50 .. -rw-r--r-- 1 hartmut 197121 18765 Aug 9 19:02 LICENSE.txt -rw-r--r-- 1 hartmut 197121 77551 Aug 25 15:06 ReleaseNotes.html drwxr-xr-x 1 hartmut 197121 0 Aug 29 11:38 bin drwxr-xr-x 1 hartmut 197121 0 Aug 29 11:38 cmd drwxr-xr-x 1 hartmut 197121 0 Aug 29 11:38 dev drwxr-xr-x 1 hartmut 197121 0 Aug 29 11:38 etc -rwxr-xr-x 1 hartmut 197121 151272 Aug 25 13:47 git-bash.exe -rwxr-xr-x 1 hartmut 197121 150760 Aug 25 13:47 git-cmd.exe drwxr-xr-x 1 hartmut 197121 0 Aug 29 11:38 mingw32 dr-xr-xr-x 9 hartmut 197121 0 Aug 29 14:49 proc drwxr-xr-x 1 hartmut 197121 0 Aug 29 14:49 tmp -rw-r--r-- 1 hartmut 197121 996808 Aug 29 11:38 unins000.dat -rwxr-xr-x 1 hartmut 197121 1293032 Aug 29 11:34 unins000.exe -rw-r--r-- 1 hartmut 197121 22815 Aug 29 11:38 unins000.msg drwxr-xr-x 1 hartmut 197121 0 Aug 29 11:38 usr $ echo $PATH /mingw32/bin:/usr/bin:/c/Dokumente und Einstellungen/Hartmut/bin:/d/Programs/Pyt hon27:/d/Programs/Python27/Scripts:/d/Batch:/d/Progs/BAT_EXE:/d/Progs/JAVA/jre7/ bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/Programme/Microso ft SQL Server/90/Tools/binn:/d/Progs/Bazaar:/c/Programme/Skype/Phone:/d/Programs /Bazaar $ echo $HOMEDRIVE C: $ echo $HOMEPATH \Dokumente und Einstellungen\Hartmut $ echo $HOME /c/Dokumente und Einstellungen/Hartmut $ git --version git version 2.9.3.windows.2 $