Atom fails to accept password to sign commit #1518
Description
Prerequisites
- Have you tried to reproduce the problem in Safe Mode?
- Have you followed all applicable steps in the debugging guide?
- Have you checked the FAQs on the message board for common solutions?
- Have you checked that your issue isn't already filed?
Description
If you normally use a GPG agent to sign the commit, but attempt to cancel the dialog from that Atom will present you a dialog of its own to gather the passphrase for the key, but entering the correct passphrase fails to sign the commit with an error message.
Steps to Reproduce
- Ensure you will get a prompt for the key by stopping any running
gpg-agent
withgpgconf --kill gpg-agent
- Be in a repository/environment where commits are signed (
commit.gpgsign=true
) - Attempt to commit through Atom, the normal GPG agent window should show.
- Cancel this window
- Atom should now show its own dialog for entering the passphrase for the key
- Enter the correct passphrase (or an incorrect one, it doesn't matter...)
- Watch it fail to commit.
Expected behavior:
Atom to sign the commit.
Actual behavior:
Atom fails to sign the commit with the following stack trace:
Uncaught (in promise) GitError: git commit --cleanup=strip -m foo in C:\Users\abneyl\Documents\GitHub\linter-flake8 exited with code 128
stdout:
stderr: 15:02:45.041030 exec_cmd.c:236 trace: resolved executable dir: C:/Users/abneyl/AppData/Local/Atom x64/app-dev/resources/app.asar.unpacked/node_modules/dugite/git/mingw64/bin
15:02:45.043963 git.c:344 trace: built-in: git commit --cleanup=strip -m foo
15:02:45.055963 run-command.c:640 trace: run_command: 'C:\Users\abneyl\AppData\Local\Temp\github-11858-7460-1nfaufe.bpb2\gpg-wrapper.sh' -bsau 4414384AEEE3FB2B
15:02:45.108964 exec_cmd.c:236 trace: resolved executable dir: C:/Users/abneyl/AppData/Local/Atom x64/app-dev/resources/app.asar.unpacked/node_modules/dugite/git/mingw64/bin
15:02:45.109964 git.c:344 trace: built-in: git config gpg.program
15:02:45.132961 exec_cmd.c:236 trace: resolved executable dir: C:/Users/abneyl/AppData/Local/Atom x64/app-dev/resources/app.asar.unpacked/node_modules/dugite/git/mingw64/bin
15:02:45.133963 git.c:344 trace: built-in: git config user.signingkey
git-askpass-atom: no user askpass specified
git-askpass-atom: requesting dialog through Atom socket
git-askpass-atom: prompt = "Please enter the passphrase for the GPG key '4414384AEEE3FB2B'."
git-askpass-atom: connection established
git-askpass-atom: writing payload
git-askpass-atom: payload written
git-askpass-atom: Atom socket stream terminated
git-askpass-atom: Atom reply parsed
git-askpass-atom: success
gpg: failed to translate osfhandle 0x00000003
error: gpg failed to sign the data
fatal: failed to write commit object
at new GitError (C:\Users\abneyl\AppData\Local\Atom x64\app-dev\resources\app\node_modules\github\lib\git-shell-out-strategy.js:121:24)
at Promise (C:\Users\abneyl\AppData\Local\Atom x64\app-dev\resources\app\node_modules\github\lib\git-shell-out-strategy.js:385:29)
at <anonymous>
Reproduces how often:
100% of the time.
Versions
OS: Windows 10 x64 Enterprise
# atom --version
Atom : 1.29.0-dev-9e0065c8f
Electron: 2.0.1
Chrome : 61.0.3163.100
Node : 8.9.3
# apm --version
apm 1.19.0
npm 3.10.10
node 6.9.5 x64
atom 1.29.0-dev-9e0065c8f
python 2.7.15
git 2.17.0.windows.1
visual studio 2015
# gpg --version
gpg (GnuPG) 2.2.7
libgcrypt 1.8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: C:/Users/abneyl/AppData/Roaming/gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
Additional Information
I've manually specified gpg.program
to be C:\Program Files (x86)\GnuPG\bin\gpg.exe
instead of letting git
determine it automatically. It's been a while since I set it up, but this was necessary to get things working properly with the GPG agent.
Note: This is possibly the same issue at its core as #814, but with a different stack trace.