Skip to content

Unclear error message when remote rejects push #3079

Closed
desktop/dugite
#143

Description

@Raul6469

Description

GitHub Desktop gives the whole git log when trying to push to a protected branch, instead of simply telling the user that it is not possible to push to that protected branch.

This issue may be related to #858

Version

GitHub Desktop version: 1.0.4

OS version: Windows 10

Steps to Reproduce

  1. Use a repository where one of the branches is protected, for example master. You must be the owner of the repo, and enforce protection for the administrators as well
  2. Checkout master, make any change, commit it, and try to push
  3. Here is the error message you get :

image

Expected behavior: A better error message, at least without all the git log when it was trying to push

Actual behavior: Well, here is the screenshot ^^

Reproduces how often: Always

Activity

  1. agisilaos commented on Oct 17, 2017

    @agisilaos
    Member

    I think I will continue working on improving these error messages. :) Any idea @j-f1, @shiftkey about the error message that will be suitable here?

  2. shiftkey commented on Oct 17, 2017

    @shiftkey
    Member

    It looks like it's not being caught by our existing error handling. The work to do this is done here:

    function getDescriptionForError(error: DugiteError): string {
    switch (error) {
    case DugiteError.SSHKeyAuditUnverified:

    @agisilaos these error codes live in dugite - we map specific error messages to these codes in the library. Here's the PR where we added a bunch of these messages, if you want to dig into that: desktop/dugite#76.

    @Raul6469 could you attach the raw output so can incorporate that into tests? It should be in the logs: Help | Show logs in Explorer.

  3. Raul6469 commented on Oct 17, 2017

    @Raul6469
    ContributorAuthor

    @shiftkey Here you go ! I tried to isolate the part related to that issue. Tell me if something is missing

    2017-10-17T14:57:26.304Z - info: [ui] [AppStore.withAuthenticatingUser] account found for repository: EclipseMaven - Raul6469 (has token)
    2017-10-17T14:57:29.872Z - info: [ui] Executing push: git -c credential.helper= push origin master:master --progress (took 3.538s)
    2017-10-17T14:57:29.876Z - error: [ui] `git -c credential.helper= push origin master:master --progress` exited with an unexpected code: 1.
    Counting objects: 3, done.
    Delta compression using up to 4 threads.
    Compressing objects:  33% (1/3)   
    Compressing objects:  66% (2/3)   
    Compressing objects: 100% (3/3)   
    Compressing objects: 100% (3/3), done.
    Writing objects:  33% (1/3)   
    Writing objects:  66% (2/3)   
    Writing objects: 100% (3/3)   
    Writing objects: 100% (3/3), 296 bytes | 296.00 KiB/s, done.
    Total 3 (delta 2), reused 0 (delta 0)
    remote: Resolving deltas:   0% (0/2)           
    remote: Resolving deltas:  50% (1/2)           
    remote: Resolving deltas: 100% (2/2)           
    remote: Resolving deltas: 100% (2/2), completed with 2 local objects.        
    remote: error: GH006: Protected branch update failed for refs/heads/master.        
    remote: error: Required status check "continuous-integration/travis-ci" is expected.        
    To https://github.com/Raul6469/EclipseMaven.git
     ! [remote rejected] master -> master (protected branch hook declined)
    error: failed to push some refs to 'https://github.com/Raul6469/EclipseMaven.git'
    
  4. added
    help wanted
    tech-debt
    on Oct 17, 2017
  5. added and removed
    tech-debt
    on Oct 18, 2017
  6. agisilaos commented on Oct 18, 2017

    @agisilaos
    Member

    @shiftkey As I see the code snippet that you provided, the case regarding the issue and what is going to return is there. Not sure I understand why it isn't being caught though. Any ideas? Interesting 🤔 Also checked the error messages over at dugite.

  7. shiftkey commented on Oct 18, 2017

    @shiftkey
    Member

    @agisilaos apologies, I did miss something. Further up in core.ts we have these lines:

    if (!acceptableExitCode) {
    gitError = GitProcess.parseError(result.stderr)
    if (!gitError) {
    gitError = GitProcess.parseError(result.stdout)
    }
    }

    This is us using dugite's error parsing to identify whether the stdout or stderr from the process match the known regexes for common errors. We have existing regexes for the specific GH00X errors that are reported from the server, but I think this one isn't being caught.

    I think this needs to be fixed over in dugite, and here's how I'd do it:

    • clone desktop/dugite and npm install to ensure it all works
    • add a new test in test/fast/git-process-test.ts to verify that the output from above doesn't return a valid enum.
    • add a new rule in GitErrorRegexes that looks for this new error message and returns a descriptive enum about the required status check (we can figure out the words for this in the review)
    • update the test to check for this new enum value, so it now passes

    Once that's in, we'll publish a new version of dugite and add a PR to Desktop, which will require us to handle it. That will close out this bug.

  8. self-assigned this
    on Oct 30, 2017
  9. shiftkey commented on Oct 30, 2017

    @shiftkey
    Member

    I've been getting some fixes into dugite today - this has been added to desktop/dugite#143 and will be fixed when I bump dugite in Desktop.

  10. locked as resolved and limited conversation to collaborators on Jul 19, 2018
  11. unlocked this conversation on Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementhelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions