GIT signed tags and passphrase

1.4k Views Asked by At

how can i make git auto enter my passphrase when i signed tags. is there an option like -- passphrase "my long passphrase", i did try using ssh-keygen but it did not help.

the Repository is on local and everything is done locally.

3

There are 3 best solutions below

4
On BEST ANSWER

in case anyone was interested, I did found a way for my problem.

1.Create new /usr/bin/gpg-with-passphrase with this contents

/usr/bin/gpg   --passphrase "My Really Long passphrase"  --batch --no-tty "$@"

2.make the new /usr/bin/gpg-with-passphrase executable

chmod 755 /usr/bin/gpg-with-passphrase

3.add this option to git config

git config gpg.program "/usr/bin/gpg-with-passphrase"

use "--global" for global

this way i dont have to enter my Long passphrase each time i sign a tag.

0
On

You're being asked for your GPG keychain password, not your SSH password. Enter than instead.

5
On

As mipadi says, it is your GPG key password that is being requested. You really don't want that on your command-line as you suggest, as that may make it visible to other users and hence compromise your security. Knowing this, the creators of gpg and git don't let you shoot yourself in your foot like that. Of course, that prompts the question of how to do this in an automated fashion so that you don't kill yourself typing your password a hundred times.

The gpg-agent is very useful for this. You may need to install that separately from gpg (e.g., on Ubuntu, you want package gnupg-agent). Then make sure ~/.gnupg/gpg.conf contains the line (uncommented):

use-agent

With the gpg-agent installed, your system may automatically invoke it for you. If the environment variable GPG_AGENT_INFO is defined, then you're good to go. Otherwise, start the agent:

eval $(gpg-agent --daemon --sh)

(That's for bash; adjust as required for other shells.)

Now when you need to unlock your GPG key, you should get a popup window (or some other method) for you to enter your password. Once entered, you shouldn't need to enter it again, as all other requests will go to the agent, which has already unlocked your key.