My question is about the gpg-agent command which performs caching for gpg keys and pass-phrases.
I want to know how to use it so that I can run multiple git tag -s commands in a script without having to enter my gpg pass-phrase each time.
The initial version of my script is something like this:
git branch -r | grep origin | grep pattern |while read BRANCH; do TAG=
basename $BRANCH; git tag -s -m “tag $TAG release” “$TAG” “$BRANCH”; done;
I have two use-cases:
- I have about 20 of release branches that I want to convert into tags.
- I have about 40 release tags that I want to redo to follow a new naming convention.
I am looking for the command line for gpg-agent to run and then the gpg command I need to run to get my pass phrase cached so that it is useable when I do a git tag -s
This can be accomplished by running
gpg-agentbefore running the script. For example:You will be prompted for your password for the first sign (unless gpg-agent had already been used prior to the first sign). If using the above method, be sure to kill the agent after you are done (e.g.
pkill gpg-agent).More information on running the agent can be found here: http://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html