Skip to content

"Incorrect function" error in Windows Git Bash terminal #404

Closed

Description

@DouglasLivingstone

Describe the bug

When running commands that require interactive input in the Windows Git Bash terminal (installed using the Windows Git installer), there is an error:

$ gh pr create
Creating pull request for [...] into master in [...]
? Title could not collect title and/or body: could not prompt: Incorrect function.

Versions:

$ git --version
git version 2.25.0.windows.1

$ gh --version
gh version 0.5.4 (2020-02-04)
https://github.com/cli/cli/releases/tag/v0.5.4

Steps to reproduce the behavior

  1. Install Git and GitHub CLI on Windows
  2. Open Git Bash, and cd into a repo
  3. Run gh pr create

Expected vs actual behavior

Expectation is the interactive UI to create a PR, instead there is an error message:

? Title could not collect title and/or body: could not prompt: Incorrect function.

Activity

  1. mislav commented on Feb 17, 2020

    @mislav
    Contributor

    Thank you for reporting! This sounds like AlecAivazis/survey#148

  2. added
    bug
    windows
    on Feb 17, 2020
  3. l3ender commented on Sep 24, 2020

    @l3ender

    Is there a workaround that can be used until the upstream issue is resolved?

  4. added
    priority-2
    on Sep 29, 2020
  5. coabr commented on Oct 5, 2020

    @coabr

    Is there a workaround that can be used until the upstream issue is resolved?

    Have you tried to use cmd instead of bash?

  6. tecnologer commented on Oct 6, 2020

    @tecnologer

    Is there a workaround that can be used until the upstream issue is resolved?

    Have you tried to use cmd instead of bash?

    Yes, the error hasn't displayed if I use cmd

  7. just1a-person commented on Dec 11, 2020

    @just1a-person
    Contributor

    Seems to be a MinTTY issue again...

    All those people who are having this issue... While installing git, what option did you choose? (See pic)

    Git Installation Choice

  8. just1a-person commented on Dec 12, 2020

    @just1a-person
    Contributor
  9. mislav commented on Dec 14, 2020

    @mislav
    Contributor

    We are aware of the issue, but we don't know what part of MinTTY is incompatible with the Survey library (or vice versa).

    A temporary workaround might be to disable prompting gh config set prompt disabled and pass all necessary information via flags instead.

  10. just1a-person commented on Dec 14, 2020

    @just1a-person
    Contributor

    or another workaround is to use Git Bash in Windows Terminal

  11. just1a-person commented on Dec 23, 2020

    @just1a-person
    Contributor

    @mislav I suggest closing this as an external bug (if you close external bugs)

  12. ChristopherSchubert commented on Apr 14, 2021

    @ChristopherSchubert

    I downloaded the latest Git (2.31.1) and the installer had a new experimental option to run 'pseudo' consoles, without requiring winpty.

    I tried it out and it resolved this issue for me on Windows 10. It allowed both arrow movement and filtering. I was able to login successfully and have not had issues since.

    I did not change the terminal emulator. As an aside, it also resolved my issues with running interactive Python in Git Bash.

  13. vilmibm commented on Apr 28, 2021

    @vilmibm
    Contributor

    Thanks for the hint, @ChristopherSchubert ! I just verified that that does indeed fix the issue.

    As we have no control over this and it comes down to minTTY defaulting to pseudo console support, I'm going to close this issue.

    For posterity, there are three workarounds for this:

    Reconfigure minTTY

    When installing Git For Windows, enable the pseudo console support for minTTY mentioned on this screen:

    image

    This fixes gh's prompting (as well as similar projects that do prompting).

    If MinTTY is already installed, you will have to reinstall it (someone please post here if there is a way to toggle this without a reinstall).

    Run with winpty

    You can prefix any invocation of gh with winpty which also fixes the issue. For example:

    winpty gh auth login
    

    This could be used as an alias if need be.

    Don't use MinTTY

    If you want to use git+bash but aren't tied to MinTTY you can run git+bash via the new Windows Terminal (or use a third party terminal emulator like Alacritty or Hyper)

  14. mislav commented on Apr 28, 2021

    @mislav
    Contributor

    You can prefix any invocation of gh with winpty which also fixes the issue. For example:

    winpty gh auth login
    

    In my own testing, using winpty caused some subtle oddities and I wouldn't recommend it as a strong workaround. For example, I seem to recall that opening an editor within winpty gh issue create didn't focus the editor (Notepad.exe) when it was opened, and instead opened it in the background. Somebody less experienced with GitHub CLI would not have noticed that Notepad opened in the background, and will perceive the gh command as being stuck.

  15. vilmibm commented on Apr 28, 2021

    @vilmibm
    Contributor

    @mislav I think we can still mention it but call out that there might be issues (like that one). I just confirmed that running with psuedo console support enabled during installation does properly focus notepad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugpriority-2windows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions