Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Idea gpg failed to sign data

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
like image 231
Scarpex Avatar asked May 01 '18 10:05

Scarpex


People also ask

How to add gpg key in IntelliJ?

If there are no keys yet, you need to generate a new pair. Open Terminal / Command Prompt / GitBash / any other shell you have on your system and run the following command: gpg --full-generate-key (for pgp 2.1. 17 and below, use the gpg --gen-key command. Answer the questions that the tool will return.

How do I turn off Commit sign?

You can disable this by running git config commit. gpgsign false This sets the configuration locally instead of globally.


2 Answers

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

like image 69
Dmitriy Smirnov Avatar answered Oct 22 '22 11:10

Dmitriy Smirnov


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>
like image 38
Bram Van Dyck Avatar answered Oct 22 '22 11:10

Bram Van Dyck