【问题标题】:Error getting triggered on every new prompt每个新提示都会触发错误
【发布时间】:2021-08-31 05:57:57
【问题描述】:

在通过 brew 更新了一堆实用程序后,我将 fish shell 从接近 3.0 升级到了 3.3.1。现在,每次我在终端中点击return 时,都会出现一系列迄今为止无害但非常分散注意力的错误消息。

$ ls
README.md         node_modules      package.json      static            tsconfig.json
mdsvex.config.cjs package-lock.json src               svelte.config.js  work.eqg
fatal: ambiguous argument '^/dev/null': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: bad revision '^/dev/null'
fatal: Refusing to point HEAD outside of refs/
fatal: No names found, cannot describe anything.
head: ^/dev/null: No such file or directory
$ echo Hi ????????
Hi ????????
fatal: ambiguous argument '^/dev/null': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: bad revision '^/dev/null'
fatal: Refusing to point HEAD outside of refs/
fatal: No names found, cannot describe anything.
head: ^/dev/null: No such file or directory
$ 
fatal: ambiguous argument '^/dev/null': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: bad revision '^/dev/null'
fatal: Refusing to point HEAD outside of refs/
fatal: No names found, cannot describe anything.
head: ^/dev/null: No such file or directory
$ 

注意:我已将提示简化为 $,因为其中很多都不能很好地复制/粘贴。 Fwiw,我正在使用 Bob the Fish,这是截图:

无论如何...关于如何解决此问题的任何想法?

【问题讨论】:

标签: macos macos-big-sur fish


【解决方案1】:

fish-shell/fish-shell issue 8105 提及:

如果您在将fish shell 更新到3.3.0 后在提示中遇到这些错误:

致命:不是 git 存储库(或任何父目录):.git 致命的:拒绝在 refs/ 之外指向 HEAD/

那么您可能在提示符中使用插入符号 (^) 进行错误重定向。 将其替换为2&gt;

它暗示:

完成完整的grep -r '\^[/&amp;]' ~/.config/fish/ 并修复所有出现的问题(尚未引用)

例如:

我运行了那个命令并找到了罪魁祸首,它是https://github.com/sjl/z-fish

【讨论】:

    【解决方案2】:

    has deprecated the ^ operator for stderr redirection;像

    foo ^/dev/null
    

    现在需要这样写:

    foo 2>/dev/null
    

    【讨论】:

      猜你喜欢
      • 2016-06-29
      • 2015-11-16
      • 2020-01-01
      • 2018-05-07
      • 1970-01-01
      • 2017-02-13
      • 1970-01-01
      • 2020-01-12
      • 2015-08-03
      相关资源
      最近更新 更多