Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git on cmd windows

Tags:

git

windows

cmd

I want to run Git commands directly on windows CMD, I downloaded Git from here http://msysgit.github.io/ but it has its own terminal called "Git Bash.vbs" and it consider the installation directory as the root. Any answers even 'No you can't run it on CMD terminal' would be apprciated.

Cheers.

like image 629
sazz Avatar asked Feb 14 '23 04:02

sazz


2 Answers

The Git for Windows installer actually has a setting to set the PATH accordingly, so you can run Git from within the Windows command lines (cmd.exe, and also PowerShell, but anywhere else too). You just need to select the option when installing:

Run Git from the Windows Command Prompt

As the installer says, if you select “Run Git from the Windows Command Prompt”, it will add (only) Git to the PATH, and you can simply execute it from other places. The default, “Use Git Bash only”, will not set the PATH but requires you to run the bundled Git Bash to use Git.

like image 126
poke Avatar answered Feb 16 '23 02:02

poke


Assuming Windows 7 is your OS: Go to Control Panel->System->Advanced System Options->Advanced->Environment_Variables(button near bottom). You should see at least three variables there: PATH, TEMP, TMP Click on PATH, click edit.

Scroll to the end of whatever PATH variables are already set. Don't modify them. Add a semi-colon (";") to the end, and then type/copy-paste/whatever the exact path to the 'bin' subdirectory of where you installed git. For example: "C:\Program Files (x86)\Git\bin\"

Apply the changes, and CMD should now run git commands.

By the way, this procedure is what you should do to also get other commands to run directly in CMD terminal as well.

like image 33
Miguel Dickson Avatar answered Feb 16 '23 02:02

Miguel Dickson