在 Windows 上的 git bash 中设置 ls 的颜色

2023-12-20

我最近安装了 Windows 版 GitHub,并且正在使用 git bash 提示符 - 现在困扰我的一件事是,当我输入 LS 时,所有目录都以蓝色列出。

如何更改我的 git bash shell,以便当我输入 LS 时,目录以不同的颜色列出为蓝色?


这并不是具体的 git 问题,而是您正在使用的 shell 的问题。在 MINGW32 上使用 Git 2.9+:

  1. C:\Program Files\Git\etc\bash.bashrc
# Uncomment to use the terminal colours set in DIR_COLORS        
eval "$(dircolors -b /etc/DIR_COLORS)"
  1. C:\Program Files\Git\etc\目录颜色

DIR 01;37 # Attribute=bold; Text color=white

DIR_COLORS 文件:

# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
#NORMAL 00    # no color code at all
#FILE 00      # regular file: use no color at all 
RESET 0       # reset to "normal" color 
DIR 01;37     # directory 
LINK 01;36    # symbolic link.  (If you set this to 'target' instead of a
              # numerical value, the color is as for the file pointed to.)

另请参阅以下帖子:

  • http://linux-sxs.org/housekeeping/lscolors.html http://linux-sxs.org/housekeeping/lscolors.html
  • http://www.kernel.org/doc/man-pages/online/pages/man5/dir_colors.5.html http://www.kernel.org/doc/man-pages/online/pages/man5/dir_colors.5.html
  • http://linux.about.com/library/cmd/blcmdl1_dircolors.htm http://linux.about.com/library/cmd/blcmdl1_dircolors.htm

对于旧版本的 Git,bash_profile in Git_Installation\etc文件夹的颜色发生变化:

LS_COLORS='di=1:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rpm=90'
export LS_COLORS
alias ls='ls -F --color --show-control-chars'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Windows 上的 git bash 中设置 ls 的颜色 的相关文章

  • Git 错误:[远程拒绝] master -> master(缺少必要的对象)

    我对 git 有一个相当令人担忧的问题 几天前 当服务器 git 出现蓝屏时 我正在提交一些更改 我们认为这实际上是由 git 引起的 从那时起 我无法向存储库提交任何更改 而其他人可以 我无法再对服务器崩溃时提交的文件提交更改 但是我可以
  • Windows 版 Github 刚刚删除了我的所有文件

    我只是尽职尽责地将我的工作备份到 github 因为由于在一个很大的工作区域上工作 我在几周内没有进行提交 Windows 版 Github 通知我需要下载最新更新 它就这样做了 我打开了存储库 然后进行了提交 当我点击同步时 它从磁盘中删
  • 从 PHP 执行程序会挂起 APACHE

    您好 提前感谢您的关注 在过去的两周里 我一直在与一些让我发疯的事情作斗争 我的 Windows 机器上安装了 APACHE 2 2 22 和 PHP 5 4 3 我试图从 PHP 脚本调用一个程序 该脚本同时调用另一个程序 这两个程序都是
  • 忽略 .gitignore 中除一个目录之外的所有内容

    我有以下目录结构 app src MyProject FirstProject Controller file 1 1 php file 1 2 php file 1 3 php Resources view 1 html twig vie
  • 使用静态构建curl链接项目

    我正在使用 CMake 和 MinGW32 在 C 中做一个小项目 它需要 libcurl 库 但是当我尝试链接静态构建 libcurl a 时 出现未定义的引用错误 undefined reference to imp curl easy
  • 如何在 Windows 7 中更改 git shell 的起始目录

    我下载并安装了 GitHub 提供的程序 包括 Git Shell 问题是我想将 Git Shell 程序的主目录设置为自定义目录 但我不知道该怎么做 我尝试从 Git Shell 快捷方式的属性菜单中更改 开始于 字段 但没有成功 任何人
  • 无法在另一台计算机上运行我的 exe 文件。 “应用程序请求运行时以异常方式终止它”错误

    我的 exe 在我编程的计算机上运行完全正常 它调试良好 发布良好 我可以将 exe 文件从 release 文件夹移动到一个新文件中 从 C pathtoqt ming47 32 bin 找到所需的 dll 文件 它仍然运行良好 但是 当
  • Qt Windeployqt 导致部署不可用

    我在用着windeployqt可执行文件来准备我的安装树 该工具将所有必需的 甚至一些不必要的 dll 复制到指定文件夹中 并对 Qt5Core dll 进行硬编码路径变量的修补 以下是我执行该工具的方法 C Qt 5 11 2 mingw
  • msys 路径转换(或 msys 的 cygpath?)

    我需要将 DEF c filepath myLib def 命令行选项从 bash 脚本传递到 MS 编译器 链接器 该路径是由 bash 脚本作为构建过程的一部分生成的 基本上 我的脚本的参数通过是 DEF c filepath myLi
  • GitHub for Windows 的“同步”有什么作用?

    使用适用于 Windows 的 GitHub 您可以 发布 分支 然后将该分支 同步 到 GitHub 同步基本上是git pull and git push 或者还有更多的事情吗 如果我想从命令行执行与 sync 完全相同的步骤 我应该做
  • 将 diffmerge 设置为可视 Git difftool 不起作用

    我正在尝试将 DiffMerge 配置为 Git 中的 difftool 但没有成功 这是我的相关部分 gitconfig文件 未显示的其他设置仅供用户使用 diff tool diffmerge difftool diffmerge cm
  • git push - 权限被拒绝 - 请求的 URL 返回错误:403

    和其他许多人一样 当我使用 git push 时 我收到下一个错误 远程 MyName 对 mmistakes minimal mistakes git 的权限被拒绝 致命 无法访问 https github com mmistakes m
  • MinGW 32“未定义对‘ExitProcess@4’的引用”

    出于学习目的 我编写了一个小型汇编程序 test asm global main extern ExitProcess 4 section text main mov ebx 0 push ebx call ExitProcess 4 比我
  • 更改 Git 存储库目录位置。

    对于 Windows 版的 Git Github 如果我有一个包含此目录的存储库 C dir1 dir2 我需要做什么才能将存储库文件移动到C dir1 显然我可以物理地复制和粘贴文件 但是我需要在 Git 端做什么呢 我在 GitHub
  • 我提交的这些图标是什么

    我最近开始从事项目工作 并使用 Windows 版 Github 提交并推送它 但如果你看看 gitignore 有一个 camel and a boom 提交旁边的图标 这些有什么目的吗 它们似乎是由 Github for Windows
  • 如何在 Windows 上从 GitHub Desktop 更新 git 版本

    我想用新的worktree中引入的功能git 2 5 https git scm com docs git worktree 但是 我不知道如何更新到最新版本的 GitHub Desktop notgit 本身 我安装桌面版 GitHub
  • Windows 版 Github - ssh-agent.exe 使用高 CPU + 100% 磁盘?

    我刚刚在我的 Windows 8 1 计算机上安装了适用于 Windows 的 Github 它似乎工作正常 只是我的计算机性能急剧下降 看看任务管理器我看到ssh agent exe正在使用一个常数25 CPU 毫无疑问 100 是我的核
  • git 克隆密码存储或缓存在哪里?

    环境定义 使用Windows 10操作系统 我使用 githttps git scm com https git scm com 和 Github 的 Git Shell 背景 当我发出如下所示的 git clone 命令时 git clo
  • mingw32-make 的目录更改错误

    我正在MinGW32下构建POCO库1 6 0 环境 Windows 7 Ultimate 32位 shell MSYS 执行成功 配置 configure Configured for MinGW config make的内容 POCO
  • 有时 git 告诉我每个文件都是新的且未暂存?

    我将对文件进行更改 转到 Windows UI 的 GitHub 提交我的更改 然后点击同步按钮 然后它说错误 尝试使用 shell 代替 所以我进入 shell 并输入git status 它告诉我存储库中的每个文件都是新的且未暂存 大约

随机推荐