Preparing the shell

We create a file ~/.debpack, in which we put some commands to be sourced at login time. Make sure you replace the exported DEB* on the last three lines by your own appropriate values.

# Thist is a bash snippet, not a script

# for gpg-agent
if test -f $HOME/.gpg-agent-info && kill -0 $(cut -d: -f 2 $HOME/.gpg-agent-info) 2>/dev/null; then
    eval $(cat $HOME/.gpg-agent-info)
else
    eval $(gpg-agent --daemon --write-env-file $HOME/.gpg-agent-info)
fi
GPG_TTY=$(tty)
# GPG_AGENT_INFO is set from within $HOME/.gpg-agent-info, but still needs to be exported
export GPG_TTY GPG_AGENT_INFO


# for dh_make, debuilder etc.
export DEBEMAIL=john@sudoe.com
export DEBFULLNAME="John Sudoe"
export DEBSIGN_KEYID=D1D9258A
	

(To find that keyid:

gpg --list-secret-keys|grep sec|egrep -o '[0-9A-F]{8}'
D1D9258A

)

In order for the gpg agent to be used at all, you must verify that

  use-agent
	

is specified in ~/.gnupg/gpg.conf.

Now source ~/.debpack from ~/.bashrc:

<snip rest of .bashrc>
. ~/.debpack
	

and source it from the current shell as well:

. ~/.debpack

For good measure, we also set those names in ~/.gitconfig, again substituting your own data:

[user]
        name = John Sudoe
        email = john@sudoe.com