--------------------------------------------------
create gpg key
--------------------------------------------------
Download and install gpg (in ubuntu gpg is alredy installed)
xxxxxxxxxx
gpg --full-generate-key
select RSA and RSA (default)
select 4096 keysize
specify how long the key should be valid (0 default)
enter your name (id github exemple)
enter your email address (like github email adress /!\ important)
veryfy with O
enter paraphrase
copy the id of rsa key
xxxxxxxxxx
pub rsa4096 2023-08-04 [SC]
**************************************** <---- this is rsa id
uid *********name and email*******
sub rsa4096 2023-08-04 [E]
for get your gpg key:
xxxxxxxxxx
gpg --list-secret-keys --keyid-format=long
past this id in this command:
xxxxxxxxxx
gpg --armor --export ****************************************(rsa id)
Copy your GPG key, beginning with -----BEGIN PGP PUBLIC KEY BLOCK----- and ending with -----END PGP PUBLIC KEY BLOCK-----.
--------------------------------------------------
add to your github account
--------------------------------------------------
In the upper-right corner of any page, click your profile photo, then click Settings.
In the "Access" section of the sidebar, click SSH and GPG keys.
Next to the "GPG keys" header, click New GPG key.
In the "Title" field, type a name for your GPG key.
In the "Key" field, paste the GPG key you copied at precedent step.
Click Add GPG key.
To confirm the action, authenticate to your GitHub account.
--------------------------------------------------
Telling Git about your signing key
--------------------------------------------------
xxxxxxxxxx
git config --global --unset gpg.format
xxxxxxxxxx
sec rsa4096/*****->copy this id<-****** 2023-08-04 [SC]
****************************************
uid [ultimate] ******email*****
ssb rsa4096/*************** 2023-08-04 [E]
xxxxxxxxxx
git config --global user.signingkey [******your id*******]
Optionally, to configure Git to sign all commits by default, enter the following command:
xxxxxxxxxx
git config --global commit.gpgsign true
initial tuto : here
please like this answer