git stash应用未知选项:-encodedCommand错误。

12

使用命令 git stash apply stash@{1} 来应用一个 git stash:

如在git stash的文档中所建议的。

但我收到了以下错误信息:

unknown option: -encodedCommand error
2个回答

23

我没有意识到...

我正在使用PowerShell(使用posh-git),当然,{}表示PowerShell代码。

因此,用''括起来将确保PowerShell将其解释为字符串。

git stash apply 'stash@{1}'

值得注意的是,posh-git在按下Tab键时会自动补全名称(这让我意识到了我的错误)。


2

将此放在此处以供Google搜索:

如果您使用的是Windows runner并且在表达式中错过了$,例如${{ github.ref }},那么也会发生这种情况。


在这种情况下特别令人困惑的是,错误会与输出交错出现,使其看起来来自于你正在调用的任何内容。例如,在我的情况下:
Run iscc.exe InstallCreation\inno\service.iss /DMyAppVersion={{ github.ref }}
  iscc.exe InstallCreation\inno\service.iss /DMyAppVersion={{ github.ref }}
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
Unknown option: -encodedCommand
Inno Setup 6 Command-Line Compiler

⬆️-encodedCommandInno Setup 6无关。


感谢您的贡献,davetapley! - Alex KeySmith

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接