You can verify what your current default key for signing is, if any, by running:
>echo "test" | gpg --sign --verbose
If a default key is configured, it will print something like:
gpg: using "something here" as default secret key for signing
where the something here is what is configured in your ~/.gnupg/gpg.conf after the default-key keyword. For example:
default-key something here
Note that no quotes are used. You can put there anything that you normally can use to identify a key, long, short key ID or fingerprint with or without spaces. It is easy to test if it worked because echo "test" | gpg --sign --verbose will print the key that was actually used after the above line;
for example, if I use
default-key 8020B2666305EE2FD53E6827C155A4EEE4E527A2
Then I get:
>echo "test" | gpg --sign --verbose
gpg: enabled compatibility flags:
gpg: using pgp trust model
gpg: using "8020B2666305EE2FD53E6827C155A4EEE4E527A2" as default secret key for signing
gpg: writing to stdout
gpg: pinentry launched (530143 gnome3 1.3.1 - xterm-256color :0.0 - 1000/1000 0)
gpg: DSA/SHA512 signature from: "0xC155A4EEE4E527A2 Carlo Wood (CarloWood on Libera) <[email protected]>"
-----BEGIN PGP MESSAGE-----
owJ4nJvAy8zAJXgwdMm7J0/VFzGe5k5iSC+6eaoktbiEq6OUhUGQi0FWTJGlQWFT
WjLrO/2rdhnqMMWsTCCVDFycAjCRyQUM//1UhTudplzXq3yd1l/x1uTQjwnKv5rC
7siwdaz+/F1Sdz7D/4jrex99n9k78+ni6wq86/O27Enm04laJFYdr3SzJuObQjkA
zvZCkA==
=B0sh
-----END PGP MESSAGE-----
Showing that 0xC155A4EEE4E527A2 (long id) was used, which is what I also could have used instead, in ~/.gnupg/gpg.conf, i.e.
default-key 0xC155A4EEE4E527A2