5

i can't commit with IntelliJ and an activated gpg in config. Currently I can only do this with git bash manuel. I use windows and i found a lot of informations for OSX but that didn't helped me.

How can I use VCS in IntelliJ without doing anything about git bash?

This is the error from IntelliJ when i try to commit something.

11:52   Commit failed with error
        0 files committed, 1 file failed to commit: update
        gpg failed to sign the data
        failed to write commit object
Scarpex
  • 51
  • 1
  • 4
  • For Windows, some instructions are [in this answer](https://stackoverflow.com/a/46884134/4126843) which worked for automatically signing commits using IntelliJ. but OSX may be different at some points – PHPirate Sep 18 '18 at 12:24

2 Answers2

3

IDE is not a terminal and cannot handle the prompt issue by gpg on the command line.

As a workaround, you could create a wrapper and tell git to use it as gpg app.

Wrapper code:

# file /home/user/gpg-no-tty.sh
#!/bin/bash
/usr/bin/gpg --batch --no-tty "$@" 

and then set your git config for the repo where you want to gpg sign commits:

[gpg]
        program = /home/user/gpg-no-tty.sh

See this comment for details

Dmitriy Smirnov
  • 6,467
  • 1
  • 16
  • 26
2

In Windows + (IntelliJ / AndroidStudio), your global git config should look like this:

user.name=<username>
user.email=<email>
user.signingkey=<key>
commit.gpgsign=true
gpg.program=<path to gpg.exe>