Installation
Install Git
Windows
Linux
Initial setting
Set committer
git config --global user.email <Your e-mail address>
git config --global user.name <Your name>
Generate GPG key
-
Install GPG command
apt-get install gnupg
On Windows, need to execute this command in bash.
-
Generate GPG key-pair
gpg --full-generate-key
- Select key type or press
Enter
key -
Input key size
Key size is to need to set
4096
bit. - Enter the length of time the key should be valid.
- Verify that your selections are correct.
-
Enter your user ID information
When asked to enter your email address, ensure that you enter the verified email address for your GitHub account
- Type a secure passphrase.
-
Copy GPG key id
In this example, copy
3AA5C34371567BD2
.gpg --list-secret-keys --keyid-format LON /Users/hubot/.gnupg/secring.gpg ------------------------------------ sec 4096R/3AA5C34371567BD2 2016-03-10 [expires: 2017-03-10] uid Hubot ssb 4096R/42B317FD4BA89E7A 2016-03-10
-
To set GPG signing key in Git
git config --global user.signingkey 3AA5C34371567BD2
-
Add profile
if [ -r ~/.bash_profile ]; then echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile; \ else echo 'export GPG_TTY=$(tty)' >> ~/.profile; fi
-
Register GPG key to GitHub
Detail information is to see GitHub Docs
-
Set always gpg signing
git config --global commit.gpgsign true