How would I change to the directory C:/Users/myname/project name
in Git Bash?
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.
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
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.
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.)
An alternative that worked for me (Windows 10 x64) is putting the full address in quotes:
cd "D:\BWayne\Documents\- School\Developer\-- Backend\Test for GitBash"
I could then do like mkdir
, touch
, etc and it successfully put them in the Test for GitBash
folder.