How do I change the directory in Git Bash with Git for Windows?
cd /c/users/myname/project\ name
Beware that ls /
, or typing cd /
followed by Tab-completion, might not show the existence of this folder, but cd /c
will still work. Also note that pwd
(to print the current working directory) might show something like /bin
, but this might not be the actual working folder for commands such as git clone
, which might use the folder from which Git Bash was started.
You will need to use quotes in your directory name, or the short version of the filename.
You can find the short version of the file name by issuing the command:
dir /x
If I remember correctly. I do not have a windows machine.
It is a version of bash
shell though, so you should be able to simply quote it. (And the dir /x
may or may not work.)
If the you know how many levels up from your current working directory, you could use cd ../project/name
to avoid writing the entire directory path.
The ..
represents moving 1 directory up.
If you are at the a directory and wanna switch to sub directory use :
cd "project name"
If you wanna go to a different path use the whole path :
cd "C:/Users/myname/project name"
But you can avoid use white spaces in project files and folders and instead use underscore