【问题标题】:How to make optional tools of Git For Windows 2.7 load customized configuration?如何使 Git For Windows 2.7 的可选工具加载自定义配置?
【发布时间】:2016-02-28 12:49:33
【问题描述】:

我几天前安装了Git For Windows 2.7.2。现在我在使用Git For Windows 提供的cmd.exe 提供的可选工具时遇到了一些问题。在之前版本的Git For Windows(或者说msysgit)中,我可以通过修改Git/etc/git-completion.bash来配置这些工具。例如:

alias ls='ls --show-control-chars --color=auto'

我用这种方式让ls正常显示包含汉字的文件名。现在看来,这种方式行不通。实际上Git/etc/ 下没有git-completion.bash。在Git/mingw64/share/git/completion 文件夹下有一个git-completion.bash。我尝试将其复制到Git/etc 并添加上面的别名,这也不起作用。这些工具只能在Git Bash 中正常工作。那么我应该如何将这些工具与git 一起配置以从cmd.exe 使用它们呢?

【问题讨论】:

  • 超级用户有duplicate这个问题。
  • 我尝试了这两个答案。似乎两者都不适用于Git 2.7.2。只有在Git Bash 中才能正常工作。
  • 所以您希望从 Windows shell 访问这些别名?
  • 是的,如果可以从 Windows shell 访问这些别名会很方便。在以前的版本中,bashrc 有效。但在 Git 2.7.2 中配置不起作用。

标签: windows git cmd


【解决方案1】:

This answer 解释了为什么您不再拥有此功能。简而言之,msysgit 提供了一个 unix shell 模拟器,mingw。 Git for Windows 是在 Windows 环境下编译的 git。

因此,ls 只是 Windows shell 中 dir 的别名,而不是 mingw 的 ls。如果要创建一些 Windows 别名,可以使用doskey。 Here's an answer 为此。

或者,我建议您开始使用PowerShell,在那里您可以使用these 等一些强大的命令设置$profile 变量。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-02-15
    • 2012-09-12
    • 2014-05-10
    • 1970-01-01
    • 1970-01-01
    • 2016-03-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多