git stash apply unknown option: -encodedCommand error
Asked Answered
A

2

12

When applying a git stash with the command:

git stash apply stash@{1}

As suggested in the documentation on git stash.

I receive the error:

unknown option: -encodedCommand error
Averse answered 15/6, 2018 at 9:47 Comment(0)
A
23

What I didn't realise...

I was in powershell (to use posh-git) and of course {} is indicating powershell code.

Therefore surrounding in '' will ensure powershell interprets it as a string.

git stash apply 'stash@{1}'

Notably posh-git autocompletes the name when pressing tab (which made me realise my error).

Averse answered 15/6, 2018 at 9:47 Comment(0)
H
2

Putting this here for Google searches:

This will also happen if you are using a Windows runner with GitHub Actions and miss the $ in an expression like ${{ github.ref }}.


What makes this especially confusing in this case, is that the error will be interleaved with the output, making it appear to come from whatever you're invoking. E.g. in my case:

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

⬆️the -encodedCommand has nothing to do with Inno Setup 6.

Hutchings answered 28/1, 2021 at 20:50 Comment(1)
Thanks for contributing davetapley!Averse

© 2022 - 2024 — McMap. All rights reserved.