在 Windows 的 git bash 中更改驱动器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38563826/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Change drive in git bash for windows
提问by Shubham Khatri
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
.
我试图浏览到我的驱动器位置E:/Study/Codes
在git bash
Windows中。在命令提示符中,为了更改驱动器,我使用E:
它在git bash
.
bash: E:: command not found.
bash: E:: 命令未找到。
How do I change my current directory location from /c/users
to E:Study/Codes
如何将当前目录位置从 更改/c/users
为E:Study/Codes
回答by Jagrati
In order to navigate to a different drive just use
为了导航到不同的驱动器,只需使用
cd /E/Study/Codes
It will solve your problem.
它会解决你的问题。
回答by KansaiRobot
Just consider your drive as a folder so do cd e:
只需将您的驱动器视为文件夹即可 cd e:
回答by Abdullah Khan
How I do it in Windows 10
我如何在 Windows 10 中执行此操作
Go to your folder directory you want to open in git bash like so
像这样转到您要在 git bash 中打开的文件夹目录
After you have reached the folder simply type git bash
in the top navigation area like so and hit enter.
到达文件夹后,只需git bash
像这样在顶部导航区域中输入,然后按 Enter。
A git bash for the destined folder will open for you.
目标文件夹的 git bash 将为您打开。
Hope that helps.
希望有帮助。
回答by Vyacheslav
In order to navigate to a different drive/directory you can do it in convenient way (instead of typing cd /e/Study/Codes), just type in cd[Space], and drag-and-drop your directory Codes with your mouse to git bash, hit [Enter].
为了导航到不同的驱动器/目录,您可以通过方便的方式(而不是键入 cd /e/Study/Codes)进行操作,只需键入 cd[Space],然后用鼠标拖放您的目录代码要 git bash,请按 [Enter]。
回答by Legends
For Windows
users:
TL;DR;
对于Windows
用户:
TL;DR;
(Quotation marks not needed if path has no blank spaces!)
(如果路径没有空格就不需要引号!)
Git Bash: cd "/C/Program Files (x86)/Android"
// macOS/Linux syntax
git 重击: cd "/C/Program Files (x86)/Android"
// macOS/Linux syntax
Cmd.exe: cd "C:\Program Files (x86)\Android"
// windows syntax
Cmd.exe: cd "C:\Program Files (x86)\Android"
// windows syntax
When using git bash
on windows, you have to:
git bash
在 Windows 上使用时,您必须:
- 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
git 重击: cd "/C/Program Files (x86)/Android"
// macOS/Linux syntax
Cmd.exe: cd "C:\Program Files (x86)\Android"
// windows syntax
Cmd.exe: cd "C:\Program Files (x86)\Android"
// windows syntax