【问题标题】:Commands called during git bash command在 git bash 命令期间调用的命令
【发布时间】:2019-09-16 22:24:45
【问题描述】:

每次我在 Windows 上的 git bash 中键入 cd 时,都会返回以下文本:

$ cd Documents/
which: no bundle in (/c/Users/nfgal/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/nfgal/bin:/c/ProgramData/DockerDesktop/version-bin:/c/Program Files/Docker/Docker/Resources/bin:/c/Program Files (x86)/Razer Chroma SDK/bin:/c/Program Files/Razer Chroma SDK/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Users/nfgal/AppData/Local/Microsoft/WindowsApps:/cmd:/c/Program Files/dotnet:/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/ProgramData/chocolatey/bin:/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/130/Tools/Binn:/c/Program Files (x86)/Microsoft SQL Server/140/Tools/Binn:/c/Program Files/Microsoft SQL Server/140/Tools/Binn:/c/Program Files/Microsoft SQL Server/140/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/Client SDK/ODBC/130/Tools/Binn:/c/Program Files (x86)/Microsoft SQL Server/140/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/140/Tools/Binn/ManagementStudio:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/c/Program Files/CMake/bin:/c/Program Files/Common Files/Autodesk Shared:/c/Program Files/Microsoft SQL Server/120/Tools/Binn:/c/Ruby26-x64/bin:/c/Users/nfgal/.cargo/bin:/c/Users/nfgal/AppData/Local/Microsoft/WindowsApps:/c/MinGW/bin:/c/Program Files/Java/jdk-11.0.2/bin:/c/Program Files/CMake/bin:/c/Program Files/Sublime Text 3:/c/Program Files/heroku/bin:/usr/bin/vendor_perl:/usr/bin/core_perl:/c/Users/nfgal/.rvm/bin:/c/Users/nfgal/.rvm/bin)

它会更改目录,但由于某种原因,它每次都会调用它。自从我安装了 rvm 以来,这种情况一直在发生。这是我的 ~/.bashrc 文件:

cd /d/
alias ll='ls -l'
alias refresh='source ~/.bash_profile'
alias subl='/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe'
alias bashrc='subl /c/Users/nfgal/.bashrc'
alias repos='cd /d/repos'

这是我的 ~/.bash_profile

test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc

~/profile 为空

【问题讨论】:

  • type cd 的输出是什么?
  • 我们能看到echo $SHELL; type -a cd的结果吗
  • ~/.bash_profile 中有什么内容?
  • 嗯,好吧,. ~/.bashrc 看起来像无限递归:.bashrc 读取 .bash_profile 读取 .bashrc 读取......除此之外,这很神秘。也许有一个系统/etc/profile 在做某事?
  • 我刚刚删除了 ~/.bash_profile 中的内容,现在可以使用了,谢谢

标签: bash git


【解决方案1】:

可能是PROMPT_COMMAND。试试echo $PROMPT_COMMAND,如果有命令用unset PROMPT_COMMAND取消设置。如果变量不在 ~/.bashrc 中,请在 ~/.bash_profile 中查找变量。

【讨论】:

  • 输入 echo $PROMPT_COMMAND 时什么也没有
【解决方案2】:

删除 ~/.bash_profile 中的行

【讨论】:

    猜你喜欢
    • 2012-09-29
    • 2018-11-16
    • 1970-01-01
    • 2018-08-06
    • 1970-01-01
    • 1970-01-01
    • 2021-12-17
    • 2017-07-19
    • 2022-12-11
    相关资源
    最近更新 更多