Change drive in git bash for windows
I was trying to navigate to my drive location E:/Study/Codes
in git bash
in windows. In command prompt in order to change drive I use E:
It returns an error in git bash
.
bash: E:: command not found.
How do I change my current directory location from /c/users
to E:Study/Codes
Solution 1:
In order to navigate to a different drive just use
cd /E/Study/Codes
It will solve your problem.
Solution 2:
Just consider your drive as a folder so do cd e:
Solution 3:
How I do it in Windows 10
Go to your folder directory you want to open in git bash like so
After you have reached the folder simply type git bash
in the top navigation area like so and hit enter.
A git bash for the destined folder will open for you.
Hope that helps.
Solution 4:
TL;DR; for Windows users:
(Quotation marks not needed if path has no blank spaces)
Git Bash: cd "/C/Program Files (x86)/Android"
// macOS/Linux syntax
Cmd.exe: cd "C:\Program Files (x86)\Android"
// windows syntax
When using git bash
on windows, you have to:
- remove the colon after the drive letter
- replace your back-slashes with forward-slashes
- If you have blank spaces in your path: Put quotation marks at beginning and end of the path
Git Bash: cd "/C/Program Files (x86)/Android"
// macOS/Linux syntax
Cmd.exe: cd "C:\Program Files (x86)\Android"
// windows syntax