How to run Ruby and GIT commands in one place on Windows

I have Ruby and GIT installed on my window window. To run GIT commands, I use GIT Bash. I use the command line to run Ruby commands.

I have not been able to run GIT commands from the CMD line, and I cannot run Ruby commands from GIT Bash. I would like to be able to run commands for GIT and Ruby from the GIT Bash (ideally), or at least from the CMD line.

What is the best way to do this?

+18
git ruby ruby-on-rails
Aug 06 '10 at 17:48
source share
6 answers

I run git commands from a CMD session all the time.

Make sure the PATH environment variable contains the ' cmd ' directory from the msysgit distribution:

 Path=C:\Path\To\Git\1.7.1\cmd 

If not, add it to your session:

 set PATH=%PATH%;C:\Path\To\Git\1.7.1\cmd 

and you're done. git and Ruby in your CMD shell.

Reverse (Ruby commands) is possible in git bash by adding a value similar to /c/path/to/Ruby/186-27/bin to the PATH value

http://img842.i_mageshack.us/img842/8749/gitbashruby.png

+26
Aug 6 '10 at 18:50
source share

To describe in detail the VonC request to create Ruby in Git - Bash.

All you have to do is add the path to your Ruby bin folder in your Windows environment variables. It should not be in the format / c / path / to / ruby, it could be C: \ Ruby193 \ bin.

Step by step for Windows 7:

  • Start
  • Search for programs and files (default text field after clicking the Start icon), search for "environment"
  • Select "modify system environment variables"
  • Click "Environment Variables" (at the bottom right of the form)
  • Add the following to the "System Variables" "PATH": C: \ Ruby193 \ bin (without single quotes)
  • Restart shell

Be sure to close the Git - bash shell and restart it to select the new environment variable.

+8
Apr 15 2018-12-12T00:
source share
  • Go to "My Computer" → "Properties" → "Advanced System Settings" → Environment Variables

  • Add a new system variable. Variable Name = RUBY_BIN . variable value = C: \ Ruby193 \ bin (the path may vary).

  • Add a new system variable. Variable Name = MSYSGIT_BIN . variable value = C: \ msysgit \ bin (the path may vary).

  • Add the variable ;% RUBY_BIN%;% MSYSGIT_BIN% to the Path under the system variables.

  • Restart the shell.

This will allow you to run ruby, git or sh (Git Bash) commands from the command line, as well as Ruby from git Bash.

+1
Feb 04 '13 at 20:19
source share

My personal setup uses msysgit and tortoisegit. I found that using the TortoiseGit Pageant manager for keys allows me to use everything from any command line, including powershell. The only annoyance: I need the added keys to show the page, which seems to be cleared every time I reload. Fortunately, I often do not reboot.

0
Aug 6 '10 at 19:08
source share

The combined answer for VonC and Rots helped me achieve the desired results.

However, since I was not familiar with editing environment variables, I must have accidentally rewritten the path to my nodejs files.

As a result, my solution involved adding the ruby ​​path and the nodejs path to my user variables instead of the system.

I am using a windows 7 machine.

0
Aug 23 '14 at 17:05
source share

when installing the ruby ​​installer, select the option "Add ruby ​​executables to your path." Then all git / ruby ​​commands will be executed from git bash.

0
Nov 23 '14 at 11:36
source share



All Articles