bahmutov / pre-git

Automatically install pre-commit / pre-push hooks in your git repo
168 stars 22 forks source link

Cannot push after installing ver. 3.10.0 #95

Closed voroshkov closed 7 years ago

voroshkov commented 8 years ago

Cannot "git push" after updating from 1.4.0 to 3.10.0 on Windows.

Getting the following error:

git ls-remote failed
pre-push Check went wrong.
pre-push { [Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "git ls-remote --heads origin test-br"
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
]
  killed: false,
  code: 128,
  signal: null,
  cmd: 'C:\\WINDOWS\\system32\\cmd.exe /s /c "git ls-remote --heads origin test-br"' }
error: failed to push some refs to 'git@github.com:<my_repo_name>'

I'm using the following config in package.json:

"config": {
    "pre-git": {
      "commit-msg": "conventional",
      "msg-pattern": "chore:.*|.*IPLNSCRD-\\d{3,}.*",
      "pre-commit": [],
      "pre-push": [],
      "post-commit": [],
      "post-merge": []
    }
  }
bahmutov commented 8 years ago

Are you sure this is due to pre-git and not general remote server? Can you skip the hook using --no-verify option?

voroshkov commented 8 years ago

I had set the config as described above, then completely removed git hooks from .git folder in local repo, then ran npm install. And this led me to error upon pushing. Then I replaced version to 1.4.0 in package.json and ran npm install again. Hooks got updated and pushing worked fine.

Haven't tried to skip the hook though.

voroshkov commented 8 years ago

I've just tested omitting the hook using --no-verify in 3.10.0 - it pushes fine.

bahmutov commented 8 years ago

Hmm in this case you will have to debug it, no idea why such weird error would happen

Sent from my iPhone

On Oct 27, 2016, at 09:18, Andrey Voroshkov notifications@github.com wrote:

I've just tested omitting the hook using --no-verify in 3.10.0 - it pushes fine.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

voroshkov commented 8 years ago

Ok, thanks for your reply. Will try to debug.

pascalvaccaro commented 7 years ago

Hi voroshkov, I ran into the exact same problem using v3.11, I am under the impression that you need credentials to execute the git ls-remote command, but these are not included when running the command from pre-push.js You need to set up your git credentials so that you're never asked for them and the git ls-remote command (and all other needing authentication) can run smoothly.

voroshkov commented 7 years ago

@Ripley511, unfortunately I couldn't dig deep enough to solve it. Just reverted to using the older version.

pascalvaccaro commented 7 years ago

Just edited my comment with a possible answer, sorry I did not write AFTER debugging ^^

voroshkov commented 7 years ago

Oh, I see, thanks! Indeed I've set up git to always ask for credentials.