我的git默认文件夹是c:\ users \用户名\.git

我应该使用什么命令进入C:/project?


当前回答

我想补充的是,如果您使用的是共享驱动器,请将路径括在双引号中,并保留反斜杠。这对我来说很管用:

$cd /path/to/"\\\share\users\username\My Documents\mydirectory\"

其他回答

以下是我遵循的步骤:

In bash, check in which directory you are by using the command: $ pwd copy the URL of the directory you want to go like after using the first command (PWD) I got: $ /c/Users/yourUsername Now I want to change this to the directory of c drive and folder MyPictures. To do that, I will go the directory of MyPictures, copy the URL, and paste it in the Git bash. However, before that: C:\MyPicture becomes $ cd /C/MyPicture (backslashes are replaced with slashes) if the folder name is having some spaces like (my program) then you need to enclose it in double quotes like: $ cd "C:\Program Files" Remember to change directory you just need to copy the requiredUrl and paste that in bash with double-quotes like: cd "required URL"

注意:URL需要斜杠。

pwd:检查你的位置(如有需要)

Cd:更改目录

如果我没理解错的话,你需要:

cd c/project

右键单击一个特定的文件夹可以帮助您减轻痛苦,而不是仅仅输入整个目录。右键点击s或右键点击“GIT bash here”

希望这对你有帮助

如何在Git Bash中更改文件夹

正如Bob提到的,你可以用cd改变目录:

cd /c/project

如果你有一个带有反斜杠或空格的Windows路径,请将路径用双引号括起来:

cd "C:\project"

Tips

您可以使用pwd检查当前文件夹。 如果路径包含空格,则需要使用引号。(cd "C:/Program Files") 在Windows上,更改Git Bash的默认起始目录。 右键单击git-bash.exe,选择属性,打开快捷方式,将“开始在:”更改为您最常用的文件夹。(截图) cd命令可以记忆为“change directory”。

另请参阅

ss64 - Bash CD命令 堆栈溢出-向前斜杠vs向后斜杠的文件路径在git bash

cd c: /用户/用户名/目录/子目录中