Windows 版 Git:.bashrc 或 Git Bash shell 的等效配置文件 [英] Git for Windows: .bashrc or equivalent configuration files for Git Bash shell
问题描述
我刚刚为 Windows 安装了 Git,很高兴看到它安装了 Bash.
I've just installed Git for Windows and am delighted to see that it installs Bash.
我想以与在 Linux 下相同的方式自定义 shell(例如为 ls -l
设置像 ll
这样的别名),但我似乎无法找到 .bashrc
或等效的配置文件.
I want to customise the shell in the same way I can under Linux (e.g. set up aliases like ll
for ls -l
), but I can't seem to find .bashrc
or equivalent configuration files.
我应该编辑什么?
推荐答案
在 ~/.bashrc
下创建一个 .bashrc
文件就可以了.~/.gitconfig
类似.
Create a .bashrc
file under ~/.bashrc
and away you go. Similarly for ~/.gitconfig
.
~
通常是您的 C:Users<您的用户名>
文件夹.在 Git Bash 终端中输入 echo ~
会告诉你那个文件夹是什么.
~
is usually your C:Users<your user name>
folder. Typing echo ~
in the Git Bash terminal will tell you what that folder is.
如果您无法创建文件(例如运行 Windows),请运行以下命令:
If you can't create the file (e.g. running Windows), run the below command:
copy > ~/.bashrc
窗口将输出错误消息(未找到命令),但文件将被创建并可供您编辑.
The window will output an error message (command not found), but the file will be created and ready for you to edit.
这篇关于Windows 版 Git:.bashrc 或 Git Bash shell 的等效配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!