繁体   English   中英

如何在Git For Windows bash shell中安装bash-git-prompt?

[英]How do i install bash-git-prompt in Git For Windows bash shell?

我将如何在Git For Windows bash shell中安装bash-git-prompt?

https://github.com/magicmonty/bash-git-prompt上的文档提到了〜/ .bashrc,而我没有。 我在/ etc中找到了bash.bashrc,在/etc/profile.d中找到了bash_profile.sh,我怀疑这可能是相关的。

Git bash已经有自己的git-prompt.sh,它可以用来以某种方式提供自己的git提示,我怀疑我必须以某种方式禁用或替换此git提示实现,方法是使用https://github.com/magicmonty/bash -git-prompt ,但我不知道如何。

有谁知道如何做到这一点?

第1步:

找到安装Git的位置,然后在目录Git/etc ,克隆repo bash-git-prompt

git clone https://github.com/magicmonty/bash-git-prompt.git

第2步:

使用任何编辑器打开文件bash.bashrc (在目录Git/etc ),注释掉所有代码,仅添加三行:

GIT_PROMPT_ONLY_IN_REPO=1
GIT_PROMPT_THEME=Evermeet  # you can choose any theme you like, just select one in Git\etc\.bash-git-prompt\themes 
source /etc/.bash-git-prompt/gitprompt.sh

保存文件,重新打开git bash窗口,瞧! 都做完了

问题:

如果发现bash窗口中的符号无法显示,可以通过以下方法解决:

right click on the title bar -> Options -> Text -> Font Select -> DejaVu Sans Mono

参考奇怪的字符

字体限制也显示在Windows 10的默认Ubuntu外壳中,但是我仅使用DejaVu Mono https://dejavu-fonts.github.io/就能看到字形字符。 @scotlynhatt的意思是在Windows上下载字体 ,安装该字体 ,然后从WSL窗口的字体菜单中选择它(右键单击标题栏->属性->字体)。

只需制作自己的.bashrc

touch ~/.bashrc

然后使用您最喜欢的编辑器进行编辑。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM