Why git commit doesn't recognize --amend on git Windows?

I am trying to follow the suggestion Can you GPG sign old commits?

λ git rebase --exec 'git commit --amend --no-edit -n -S' -i develop

But getting

error: unknown option `amend'

I am running git version 2.23.0.windows.1


With the use of λ in the prompt string I guess you're using cmder as the terminal with cmd as the shell. In cmd single quotes aren't the quoting symbol so the exec string isn't passed as a single parameter. You need to change to double quotes:

git rebase --exec "git commit --amend --no-edit -n -S" -i develop

Or better change to powershell or other shells (you should already have bash if you install git on Windows). They recognize ' as the quote character so you don't need to change anything, and you get more features