github icon indicating copy to clipboard operation
github copied to clipboard

Signed commits not being accepted with GPG running in Cygwin, throws "gpg-no-tty.sh: line 22: exec: gpg: not found error: gpg failed to sign the data fatal: failed to write commit object"

Open meta-state opened this issue 9 years ago • 5 comments

Per request, this has been resubmitted from #1039

Prerequisites

Description

When attempting to commit staged changes with a signed commit, Atom fails to create commit and throws an error msg. However signed commits are getting passed through Zsh shell running in hyper terminal.

Steps to Reproduce

  1. Install cygwin: [v2.881 64bit]
  2. Run cygwin to install the following packages: git [2.13.2] gnupg: [v1.4.21-1] zsh [5.3]
  3. Generate a GPG key w/ passphrase
  4. Make changes to a repo in Atom
  5. Move changes from 'Unstaged Changes' to 'Staged Changes'
  6. Attempt to commit changes with GPG signature
  7. Password dialog pops up asking for passphrase
  8. Hit 'enter'
  9. Commit fails

Expected behavior:

For cryptographically signed commits to be accepted

Actual behavior:

Atom throws the following error: gpg-no-tty.sh: line 22: exec: gpg: not found error: gpg failed to sign the data fatal: failed to write commit object

Reproduces how often:

100%

Versions

OS: [win 10 64bit] cygwin: [v2.881 64bit] shell: [Zsh 5.3, oh-my-zsh] gitflow: [AVH Edition] gnupg: [v1.4.21-1] terminal: [Hyper 1.3.3]

Running atom --version in cmd.exe produces: Atom: [1.18.0] Electron [1.3.15] Chrome: [52.0.2743.82] Node: [6.5.0]

Running apm --version in cmd.exe produces: apm: [1.18.1] npm: [3.10.10] node: [6.9.5 x64] git: [2.13.2]

Note: *Running both atom --version and apm --version in hyper zsh shell produced no output for my particular setup.

Additional Information

gpg set as the default in global config git config --global gpg.program $(which gpg)

Every commit signed by default set to true git config --global commit.gpgsign true

The signingkey set with: git config --global user.signingkey <key-id>

Path to gpg in windows env variables set to: C:\cygwin64\bin\gpg.exe

Running: git config --list --show-origin produces:

...
...
file:/cygdrive/c/Users/$USER/.gitconfig  gpg.program=gpg
file:/cygdrive/c/Users/$USER/.gitconfig  commit.gpgsign=true
...
file:.git/config        gpg.program=gpg

Running which gpg Produces: /usr/bin/gpg

Running process.env.PATH from atom chrome dev-tools along with echo ${PATH} in terminal both produce: ... C:\cygwin64\bin\gpg ...

Replacing gpg1.4 for gpg2 produced the same error msg within Atom, while cryptographically signed commits continued to work through Zsh shell for both gpg and gpg2.

Earlier, I manually set the Path to cygwin in windows environmental variables to: C:\cygwin64\bin\ but it produced a *** fatal error - cygheap base mismatch detected error so I removed it. The error also produced instruction to perform a system wide search for cygwin1.dll, to remove any older duplicates, and reboot, however the system only found one cygwin1.dll file located in C:\cygwin64\bin\ and rebooting did not resolve it either, so I ended up unsetting it from windows path.

Any help would be much appreciated!

Update:

  • corrected miscellaneous grammar / spelling oversights.

meta-state avatar Jul 30 '17 01:07 meta-state

What happens if you commit inside the git shell? Cygwin and git shell don't play nice.

Is there a reason you are using cygwin? I find for my needs on Windows that the git shell does 99% of what I need involving git and python development.

pconwell avatar Jul 30 '17 03:07 pconwell

I am able to commit with signed commits through my git zsh shell, either through cmd.exe or hyper terminal.

I prefer zsh [oh-my-zsh] on hyper over bash as I find it offers a richer UI/UX for development.

I've switched to using cygwin in order to get zsh working on windows after trying Windows Subsystem for Linux (WSL) which currently has unresolved firewall compatibility issues.

meta-state avatar Jul 30 '17 04:07 meta-state

Also to note, initially I was receiving the following error only:

C:\Users\User\AppData\Local\atom\app-1.18.0\resources\app\node_modules\github\bin\gpg-no-tty.sh: line 22: exec: gpg: not found
error: gpg failed to sign the data
fatal: failed to write commit object

It's not until I added the path C:\cygwin64\bin\ to windows environmental variables that I began receiving the cygheap base mismatch detected error.

I also tried rebasing cygwin, but that didn't help either.

Meanwhile, with or without that path being set in windows environmental variables, I am able to commit signed commits through Zsh shell with gpg.

Based on that fact, I will update the issue's subject to reflect the original error msg I was receiving as I am uncertain whether or not it is actually a cygheap base mismatch error that is causing the signed commits to fail, but rather most likely something else.

meta-state avatar Jul 30 '17 06:07 meta-state

I was able to reproduce this using the gpg command builtin to Git 4 Windows' usr\bin directory. I have not tried Gpg4Win.

Spitfire1900 avatar Nov 14 '17 14:11 Spitfire1900

Upgrading to Git for Windows 2.15.0 64-bit resolved by issue; I was previously on 2.14.1 64-bit

Spitfire1900 avatar Nov 14 '17 15:11 Spitfire1900