在 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:37:52  来源:igfitidea点击:

Change drive in git bash for windows

windowsgitgit-bash

提问by Shubham Khatri

I was trying to navigate to my drive location E:/Study/Codesin git bashin windows. In command prompt in order to change drive I use E:It returns an error in git bash.

我试图浏览到我的驱动器位置E:/Study/Codesgit bashWindows中。在命令提示符中,为了更改驱动器,我使用E:它在git bash.

bash: E:: command not found.

bash: E:: 命令未找到。

How do I change my current directory location from /c/usersto E:Study/Codes

如何将当前目录位置从 更改/c/usersE: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 中打开的文件夹目录

enter image description here

在此处输入图片说明

After you have reached the folder simply type git bashin the top navigation area like so and hit enter.

到达文件夹后,只需git bash像这样在顶部导航区域中输入,然后按 Enter。

enter image description here

在此处输入图片说明

A git bash for the destined folder will open for you.

目标文件夹的 git bash 将为您打开。

enter image description here

在此处输入图片说明

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 Windowsusers: 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 bashon 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