Skip to content

git command "exited with an unexpected code: 1" #17362

Closed

Description

@ycwang-hello

The problem

My GitHub Desktop constantly says error launching git: or Git returned an unexpected exit code '1' which should be handled by the caller (getStatus).', and finally it may say that it can't find my repository. I can click "Locate..." to open the repository again, but the error occurs again. It seems that each git command can fail like this.

In PowerShell, I ran the command that is said to "exited with an unexpected code: 1" in the log, e.g.

C:\Users\<username>\AppData\Local\GitHubDesktop\app-3.3.1\resources\app\git\cmd\git.exe log -g --no-abbrev-commit --pretty=oneline HEAD -n 2500 --

And nothing went wrong.

Also, this error can occur for any repository. Sometimes it just happens randomly.

Release version

3.3.1

Operating system

Windows 11

Steps to reproduce the behavior

Log files

This is an example; The log also shows a lot of git commands that "exited with an unexpected code: 1"

2023-09-09T13:46:16.512Z - error: [ui] `git log -g --no-abbrev-commit --pretty=oneline HEAD -n 2500 --` exited with an unexpected code: 1.
stderr:
error launching git: 

Screenshots

No response

Additional context

No response

Activity

  1. steveward commented on Sep 11, 2023

    @steveward
    Contributor

    @ycwang-hello thanks for the issue. In the past this has sometimes been resolved by trying a fresh install. Could you try performing a fresh installation of GitHub Desktop by following these steps?

    Here's how to do that:

    1. Close GitHub Desktop
    2. Open File Explorer
    3. Go to %LocalAppData% and delete the GitHubDesktop directory
    4. Go to %AppData% and delete the GitHub Desktop directory
    5. Reinstall GitHub Desktop from http://desktop.github.com

    Let me know if that helps at all.

  2. added
    more-info-needed
    on Sep 11, 2023
  3. ycwang-hello commented on Sep 14, 2023

    @ycwang-hello
    Author

    Thanks a lot for the response @steveward. After a fresh installation, I can add some repositories and use it without errors. However, if I close and reopen GitHub Desktop, I encounter the same error again.

  4. removed
    more-info-needed
    on Sep 14, 2023
  5. steveward commented on Sep 14, 2023

    @steveward
    Contributor

    Is there any security software on your machine that could be interfering with GitHub Desktop?

    Unfortunately there isn't much info in the logs about what specifically is causing this.

  6. ycwang-hello commented on Sep 15, 2023

    @ycwang-hello
    Author

    I have confirmed that it is due to the security software. With the security software paused, I see no error using the GitHub Desktop. Thank you!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions