Skip to content

Git commit takes a really long time on a specific repo #2518

Closed

Description

@radumg

Description

GitHub desktop either takes a really long time (5 minutes or more) to commit, but only on a specific repository. I've now also had it fail for the first time ever since switching to the new desktop app.

Version

GitHub Desktop version: 0.8.0

OS version: Microsoft Windows [Version 10.0.15063]

Steps to Reproduce

  1. make changes to any file in repo
  2. commit using GitHub desktop UI
  3. GitHub desktop takes more than 5 minutes to commit
  4. does not happen on other repositories

The affected repository is a straight-up duplication of this public repo : https://github.com/typicode/json-server

Expected behavior: commit in the usual timeframe, usually under 10 seconds, even for large commits.

Actual behavior: commit takes 5 minutes or more. Failed on only 1 occasion,
Reproduces how often: It's slow 100% of the time with this repo but failed only once.

Logs

Please see attached file for a copy-paste of the error window, to me it looks like it's actually executing the code of the repo, which would be highly dubious.
Also attached the desktop log.

git error
logs.zip

Additional information

This affected repository belongs to my organisation whilst most of the other repos are on my own account.

Activity

  1. added
    bug
    on Aug 21, 2017
  2. iAmWillShepherd commented on Aug 21, 2017

    @iAmWillShepherd
    Contributor

    Does it take long to commit using the CLI?

  3. shiftkey commented on Aug 21, 2017

    @shiftkey
    Member

    @radumg it looks like the Git pre-commit hook is failing, which blocks the commit from completing. It's hard for me to tell what's in the git commit hook (husky -> NPM -> ???) - could you shed some light on that?

  4. radumg commented on Aug 21, 2017

    @radumg
    Author

    thanks @iAmWillShepherd and @shiftkey for the quick take-up.

    Just tried with CLI and same behaviour, even when changes are un-staged, see the 2 screenshots.

    git commit
    git unstaged commit

    As for the husky pre-commit hook : now that I knew what to look for, I dug around the repo and husky is a node module and it seems it has some git hooks, see screenshot. It's not something I added, must have been part of the original repo.
    husky hooks

  5. j-f1 commented on Aug 21, 2017

    @j-f1
    Contributor

    Here’s your culprit:

        "test": "npm run test:cli && npm run test:server && eslint .",
        "test:cli": "npm run build && cross-env NODE_ENV=test mocha test/cli/*.js",
        "test:server": "cross-env NODE_ENV=test mocha test/server/*.js",
        "start": "babel-node src/cli/bin",
        "format": "eslint . --fix",
        "build": "babel src -d lib --copy-files",
        "toc": "markdown-toc -i README.md",
        "prepublishOnly": "npm run build && pkg-ok",
        "precommit": "npm test"

    source

    One of build, test:cli, test:server, or eslint is slowing you down.

  6. shiftkey commented on Aug 21, 2017

    @shiftkey
    Member

    @radumg pre-commit hooks in Git will fail Git by returning a non-zero exit code. There might be details in the log files around the actual failure (if you didn't scroll the output of the dialog to the bottom at the time).

    EDIT: apoloiges - you attached the logs. Let me read them over.

  7. shiftkey commented on Aug 21, 2017

    @shiftkey
    Member

    Aha!

      19 passing (59s)
      1 failing
    
      1) cli fixtures/seed.json --no-cors=true "before each" hook for "should not send Access-Control-Allow-Origin headers":
         Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
    
  8. shiftkey commented on Aug 21, 2017

    @shiftkey
    Member

    @radumg so a test in the pre-commit hook failed due to a timeout of 5s (which fits with the slow commit issue) which then caused the commit itself to fail. Closing this out as an external issue.

  9. radumg commented on Aug 21, 2017

    @radumg
    Author

    Thanks all for the assistance 🍻 , hadn't dealt with commit hooks (or this much JS) until now.
    Will reach out to original repo owner @typicode .

  10. locked as resolved and limited conversation to collaborators on Jul 21, 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

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions