0

I am installing Git on a Windows 10 machine. I do not know how to place the bash.exe file in my Git path (or even really know what that means). I am using IPython Nootebook 2.7 to run the following codes:

import os 
os.environ['path']+="C:\Program Files\Git\\bin"

and ran:

%%bash
cd /tmp
rm -rf Testing
git clone git@github.com:rahuldave/Testing.git

I received the following error message:

Couldn't find program: u'bash'

Finally, I ran this code:

%%bash
ls /tmp/Testing

and I received the same error message.

Any help would be greatly appreciated.

Dimitris Fasarakis Hilliard
  • 150,925
  • 31
  • 268
  • 253
James
  • 37
  • 1
  • 6
  • 1
    Is this any help: http://stackoverflow.com/questions/10681101/git-bash-doesnt-see-my-path ? – Chris Lear Sep 07 '15 at 16:05
  • @James, Are you certain that your installation of Git is in "C:\Program Files\Git" and not in "C:\Program Files (x86)\Git" (are you using 64 bit W10 or 32 bit?). Also it seems that you are using backslash 3 times, but only once you are escaping it ('\\'). – vordhosbn Sep 07 '15 at 16:05

3 Answers3

4

Jim, looks like we are in the same class and troubleshooting the same initial configuration. What worked for me in my Windows 7 environment, was to escape all slashes (not just ...\bin) and add ';' to separate the path, e.g.

os.environ['path']+=";C:\\Program Files\\Git\\bin"

Also, you may need to provide the full bash path for git execution, e.g.

/c/'Program Files'/Git/bin/git clone git@github.com:yourusername/Testing.git
2

Bash is a Unix shell that is not installed by default on Windows. This is why you are receiving the Couldn't find program: u'bash' error - your script is telling Windows to use Bash to execute this script but Windows doesn't know what that is.

There are two solutions I would suggest to you :

  1. If your end goal is to use git to interact with GitHub repositories, simply install their GitHub Desktop for Windows application which greatly simplifies the use of git and takes the terminal out of the equation.

  2. If you want to be able to use the git command line or you want to push to repositories not on GitHub, install Cygwin. This is something of a terminal-like program for Windows that is much more similar to Linux and will simplify things like git command line. When you install it, you can specify to install git which will automatically add it to Cygwin's path

Kyle
  • 893
  • 1
  • 9
  • 20
0

If Michael's solution doesn't work for you.

Try to add C:\Program Files\Git\bin to your local environment.

Search for "Edit environment variables for your account" -> then in PATH add C:\Program Files\Git\bin if GIT is installed on this location.

64 bit Git on 64 bit Windows in my case.

Couldn't find program: u'bash' set up envirioment to run bash within iPython notebook Run bash within Jupyter iPython Notebook

Don't forget to restart your jupyter notebook, if you are setting it up for Jupyter.

Gunay Anach
  • 1,193
  • 1
  • 13
  • 19