Gitã®ã³ãããã«çœ²åãã€ããããã®æé ã§ãâð¥
â» äžçªæåŸã«åç»ãè¿œå ããŸããâïž
眲åä»ãã³ãããã¯ããã°äžã«ãããžãä»ããŸãã
- Unverified - äœããééã£ãŠããŠèªèšŒã«å€±æããã³ããã
- Verified - æ¬äººç¢ºèªã«æåããã³ãããïŒãããã¯ãã©ãŠã¶ããGitHubäžã§è¡ãããã³ãããïŒ
- ãããžãªã - 眲åãã€ããŠããªãã³ããã
眲åä»ãã³ãããã®æ€èšŒã«ã€ããŠ
About commit signature verification - GitHub DocsïŒEnglishïŒ
åæ
- Windows10
- 管çè ã¢ã«ãŠã³ã
- Gitã®ãŠãŒã¶èšå®ãé©åã«èšå®ãããŠããïŒæ¬èšäºã®å·¥çšããã¹ãŠçµããåŸã«èšå®ããŠãOKïŒ
git config --global user.name
git config --global user.email
Package managerãå
¥ããã
ãœãããŠã§ã¢ã€ã³ã¹ããŒã«ã楜ã«ãªãã®ã§ããããããWindowsãªãChocolateyãmacOSãªãHomebrewãå
¥ããŠãããŸãããïŒð
-
Chocolateyã®ã€ã³ã¹ããŒã«æ¹æ³ -
choco
ã³ãã³ãã䜿ããããã«ãªã -
Homebrewã®ã€ã³ã¹ããŒã«æ¹æ³ -
brew
ã³ãã³ãã䜿ããããã«ãªã
â» ããããå©çšããªãå Žåã§ããä»»æã®æ¹æ³ã§å¿
èŠãªãœãããŠã§ã¢ãã€ã³ã¹ããŒã«ã§ããŸã
â» ããããã®èšäºã®choco
ãbrew
以å€ã®å
容ãèŠãŠããã ãããšããããã§ãâº
ãã°ããã£ããã£ã¯Windows 10ã§å®æœãããã®ããµã³ãã«ãšããŠæ²èŒããŠããŸã
1. ç°å¢ãæŽããã
ãŸãã¯GPGãã€ã³ã¹ããŒã«ãããŠãããã確èªããŸãããã
ã·ã§ã«ã«ã次ã®ã³ãã³ããå
¥åããŠã¿ãŸãã
gpg --version
ã·ã§ã«ãšã¯
- WindowsïŒPowerShell
- macOSïŒã¿ãŒããã«ãiTerm2ãªã©
GPGã®ã€ã³ã¹ããŒã«æ¹æ³ã¯ïŒ
choco install gpg4win -y
sudo brew install gpg
GPGãã€ã³ã¹ããŒã«ããã¯ããªã®ã«ãgpgãšããã³ãã³ããèªèã§ããªãããšèšãããå Žåã¯ãã·ã§ã«ãç«ã¡äžãçŽããŠã¿ãŸãããã
2. Gitã®èšå®ã確èªããã
ã·ã§ã«ã«ããããå
¥åããèšå®ããŠãããŠãŒã¶åãšã¡ãŒã«ã¢ãã¬ã¹ãæ§ããŠãããŸãã
äœãå€ãåºåãããªãå Žåã¯èšå®ã誀ã£ãŠããã®ã§ãGitã®ãŠãŒã¶èšå®ãèŠçŽããŠãã ããã
git config user.name
git config user.email
2. ç§å¯éµãçºè¡ããã
次ã®ã³ãã³ããå ¥åããŸãã
gpg --full-generate-key
質åã«çããã
ããã€ã質åãããã®ã§ãåçããŠãããŸãããã
èšå | å ¥å | åè |
---|---|---|
ãåžæã®éµã®çš®é¡ãéžæããŠãã ãã ããªãã®éžæã¯? |
1 |
ããã€ãåè£ãåºãŠããŸãã |
RSA éµã¯ 1024 ãã 4096 ãããã®é·ãã§å¯èœã§ãã éµé·ã¯? |
4096 |
ç¹ã«çç±ããªããã°æ倧å€ã«èšå®ããŸãã åèïŒå ¬ééµãšç§å¯éµã®ãµã€ãºã«é¢ããèæ ®äºé - IBM Documentation |
éµã®æå¹æéãæå®ããŠãã ããã éµã®æå¹æéã¯? |
ä»»æ | ç¡æéã§ããå Žåã¯0 ãšå
¥åããŸã |
ããã§æ£ããã§ãã? | y |
ããçŽãå Žåã¯N
|
æ¬å | åé ã§æ§ããuser.name ã®å€ |
|
é»åã¡ãŒã«ã»ã¢ãã¬ã¹ | åé ã§æ§ããuser.email ã®å€ |
|
ã³ã¡ã³ã | ç¹ã«å ¥åããªããŠãOK | |
åå(N)ãã³ã¡ã³ã(C)ãé»åã¡ãŒã«(E)ã®å€æŽããŸãã¯OK(O)ãçµäº(Q)? | O |
ä¿®æ£ãããã®ããªããã°ãOïŒããŒïŒããå ¥åããŸã |
gpg (GnuPG) 2.3.6; Copyright (C) 2021 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
ãåžæã®éµã®çš®é¡ãéžæããŠãã ãã:
(1) RSA ãš RSA
(2) DSA ãš Elgamal
(3) DSA (眲åã®ã¿)
(4) RSA (眲åã®ã¿)
(9) ECC (眲åãšæå·å)
(10) ECC (眲åã®ã¿)
(14) ã«ãŒãã«ååšããéµ
ããªãã®éžæã¯? 1
RSA éµã¯ 1024 ãã 4096 ãããã®é·ãã§å¯èœã§ãã
éµé·ã¯? (3072) 4096
èŠæ±ãããéµé·ã¯4096ããã
éµã®æå¹æéãæå®ããŠãã ããã
0 = éµã¯ç¡æé
<n> = éµã¯ n æ¥éã§æéåã
<n>w = éµã¯ n é±éã§æéåã
<n>m = éµã¯ n ãæéã§æéåã
<n>y = éµã¯ n 幎éã§æéåã
éµã®æå¹æéã¯? (0)0
éµã¯ç¡æéã§ã
ããã§æ£ããã§ãã? (y/N) y
GnuPGã¯ããªãã®éµãèå¥ããããã«ãŠãŒã¶IDãæ§æããå¿
èŠããããŸãã
æ¬å: XXXXXXXXXXXX
é»åã¡ãŒã«ã»ã¢ãã¬ã¹: XXXXXXXXXXXX@example.com
ã³ã¡ã³ã:
次ã®ãŠãŒã¶IDãéžæããŸãã:
"XXXXXXXXXXXX <XXXXXXXXXXXX@example.com>"
åå(N)ãã³ã¡ã³ã(C)ãé»åã¡ãŒã«(E)ã®å€æŽããŸãã¯OK(O)ãçµäº(Q)? O
ãããŸã§é²ããšããã¹ã¯ãŒãã決ããããã«ä¿ãããŸãã
å®å
šãªãã¹ã¯ãŒããèããŠå
¥åããŠãã ããã
以äžã§éµã®çæã¯å®äºã§ãã
ããŸããã£ããã»ã»ã»
次ã®ãããªåºåãããããšæããŸãã
gpg: 倱å¹èšŒææžã 'C:\\Users\\XXXXXXXXXXXX\\AppData\\Roaming\\gnupg\\openpgp-revocs.d\\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.rev' ã«ä¿ç®¡ããŸããã
å
¬ééµãšç§å¯éµãäœæãã眲åããŸããã
pub rsa4096 yyyy-mm-dd[SC]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
uid XXXXXXXXXXXX <XXXXXXXXXXXX@gmail.com>
sub rsa4096 yyyy-mm-dd [E]
å ã«é²ãŸãªãïŒïŒ
ããããã®ã©ã³ãã ã»ãã€ãã®çæãå¿ èŠã§ããããŒããŒããæã€ãããŠã¹ãåããããã£ã¹ã¯ã«ã¢ã¯ã»ã¹ãããªã©ã®ä»ã®æäœãçŽ æ°çæã®éã«è¡ãããšã§ãä¹±æ°çæåšã«ååãªãšã³ããããŒãäŸçµŠããæ©äŒãäžããããšãã§ããŸãã
ã ããã10ç§ããããªãçšåºŠã§éµã®çæã¯å®äºããŸããããã®ã¡ãã»ãŒãžã§æ¢ãŸãå Žåã¯ãšã³ããããŒããŒã«ãæ¯æžããç¶æ
ã«ãªã£ãŠããŸãã
æžãããŠããéããããŒããŒããå
¥åãããããŠã¹ãåããããããŠãéµçæãšé¢ä¿ãªãå¥ã®äœæ¥ãããŠã¿ãŠãã ããã
3. ç§å¯éµã®Key IDãååŸããã
ãŸãã¯Key IDãååŸããŸãã
次ã®ã³ãã³ããå®è¡ããŠãã ããã
gpg --list-secret-keys --keyid-format LONG
ãããšä»¥äžã®ããã«ãäœã£ãéµã®äžèŠ§ãååŸã§ããŸãã
C:\Users\___user_name___\AppData\Roaming\gnupg\pubring.kbx
----------------------------------------------------------
sec rsa4096/ð¥ð¥ð¥ 2022-06-21 [SC]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
uid [ 究極 ] XXXXXXXXXXXX <XXXXXXXXXXXX@gmail.com>
ssb rsa4096/XXXXXXXXXXXXXXXX 2022-06-21 [E]
ä»åäœã£ãéµã®ãð¥ð¥ð¥ãã®éšåãã³ããŒããŠãã ããã
ãã®åŸã§2åã»ã©äœ¿çšããŸãã
4. ã³ãããæã«äœ¿ãéµãGitããã«æããŠãããã
次ã®ããã«ãã³ããŒããKey IDã䜿ã£ãŠGitã®èšå®ãå€æŽããŸãã
ä»åã¯ã°ããŒãã«èšå®ãå€æŽããŸãããå¿
èŠãããã°ãªããžããªããšã®èšå®ãè¡ã£ãŠãã ããã
git config --global user.signingkey ð¥ð¥ð¥
次ã®ã³ãã³ããå ¥åãããšèšå®å 容ã衚瀺ãããŸãã
git config --global -e
user
ã®é
ç®ã«signingkey
ãå¢ããŠããããšã確èªã§ãããæåã§ãã
:q!
ãšå
¥åããŠçµäºããŸãããïŒã·ã§ã«ãéããŠãOKïŒã
[user]
email = XXXXXXXXXXXX@example.com
name = XXXXXXXXXXXX
+ signingkey = ð¥ð¥ð¥
5. å ¬ééµãçºè¡ããã
gpg --armor --export ð¥ð¥ð¥
ç¡äºã«å ¬ééµãäœãããšã次ã®ãããªãšãŠãé·ãæååãåºåãããŸãã
-----BEGIN PGP PUBLIC KEY BLOCK-----
ãã¡ããã¡ãé·ãæåå
ãã¡ããã¡ãé·ãæåå
ãã¡ããã¡ãé·ãæåå
-----END PGP PUBLIC KEY BLOCK-----
ã-----BEGIN PGP PUBLIC KEY BLOCK-----ãããã-----END PGP PUBLIC KEY BLOCK-----ããŸã§ãã¹ãŠã³ããŒããŠãã ããã
6. GitHubããã«å ¬ééµãæž¡ãã
ãªãGitHubããã«å
¬ééµãæž¡ãã®ïŒ
ä»åãgpg --full-generate-key
ã§äœã£ããã®ã¯ç§å¯éµãgpg --armor --export
ã§äœã£ããã®ã¯å
¬ééµãšåŒã°ããŠããŸãã
å
¬ééµãšã¯æ¥ç¶å
ã«æž¡ãå京é ã§ããããããããæ
å ±ã®å庫ãã®æžç· ãã«äœ¿ãããŸãïŒæå·åçšïŒã
ç§å¯éµãšã¯ããã®å京é ãéããããå¯äžã®éµã§ãïŒåŸ©å·çšïŒã
ãç§ã®ããŒã¿ãæ¹ãããããªãããã«ãæžãæããæš©éã¯ãã®å京é ã§ãã£ããæžç· ãããŠãïŒããšãGitHubãããšçŽæããããã«å ¬ééµãæž¡ããªããã°ãªããŸããã
- GitHubã«ãã°ã€ã³ãã
- SettingsããŒãžããSSH and GPG keysããŒãžãéã
- New GPG Keyãã¿ã³ãã¯ãªãã¯ãã
- ããã¹ããã£ãŒã«ããTitleãã«ä»»æã®æååãå ¥åããïŒä»ã䜿ãã®PCã®ååãããšãã°ãäœä»£ç®Windows PCããšãã§ãOKïŒ
- ããã¹ããã£ãŒã«ããKeyãã«ã³ããŒããå ¬ééµã貌ãä»ãã
- Add GPG keyãã¿ã³ãã¯ãªãã¯ãã
7. ã³ãããã»ããã·ã¥ããŠã¿ãã
ä»»æã®ãªããžããªã«ã³ããããç©ãã§ã¿ãŸãããã
ãã®éã-S
ãªãã·ã§ã³ãã€ãããšèšŒææžã€ãã§ã³ãããããããšãã§ããŸãã
ãŸãã次ã®èšå®ãé©å¿ãããš-S
ãªãã·ã§ã³ãªãã®ããã©ã«ãã§çœ²åä»ãã³ãããã«ããããšãã§ããŸãã
git config --global commit.gpgsign true
Windowsã®æ¹åã
gpg: skipped "ð¥ð¥ð¥": No secret key
ãšãããšã©ãŒãåºãå Žåãããããã以äžã®ã³ãã³ããå®è¡ããŠãããŠãã ããã
git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"
ä»»æã®ãªããžããªã«ã³ããããç©ãã§git push
ã§ããããGitHubäžã§ã³ããããã°ã確èªããŸãã
ç¡äºãç©ãã ã³ãããã«ãVerifiedããããžãã€ããŠããèšå®æåã§ãïŒ
ãã€ããããŸã§ããïŒð¥³ð¥
ããŸãïŒéµã®åé€
誀ã£ãŠäœã£ãŠããŸã£ãéµããäžèŠã«ãªã£ãéµãåé€ããæ¹æ³ã玹ä»ããŸãã
ãŸãã¯ç§å¯éµãåé€ããŸã
åé€ãããç§å¯éµã«çŽã¥ããã¡ãŒã«ã¢ãã¬ã¹ãKey IDïŒð¥ð¥ð¥ïŒãæ·»ããŠã--delete-secret-keys
ãå®è¡ããŸãã
gpg --delete-secret-key ã¡ãŒã«ã¢ãã¬ã¹ãŸãã¯Key ID
å®è¡åŸã«åºãŠããèšåãšãã€ã¢ãã°ã®å 容ãããèŠãŠãåé¡ãªããã°åé€ãå®æœããŸãã
PS C:\Users\___user_name___> gpg --delete-secret-key XXXXXXXXXXXXXXX@example.com
gpg (GnuPG) 2.3.6; Copyright (C) 2021 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
sec rsa4096/XXXXXXXXXXXXXXXX 2022-06-21 XXXXXXXXXXXXXXX <XXXXXXXXXXXXXXX@example.com>
ãã®éµãéµãªã³ã°ããåé€ããŸãã? (y/N) y
ããã¯ç§å¯éµã§ã! æ¬åœã«åé€ããŸãã? (y/N) y
ç¶ããŠãå ¬ééµã®åé€ã§ã
å
¬ééµã®åé€ã«ã¯--delete-key
ãçšããŸãã
gpg --delete-key ã¡ãŒã«ã¢ãã¬ã¹ãŸãã¯Key ID
åé¡ãªããã°åé€ãå®æœããŸãã
PS C:\Users\___user_name___> gpg --delete-keys XXXXXXXXXXXXXXX@example.com
gpg (GnuPG) 2.3.6; Copyright (C) 2021 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
pub rsa4096/XXXXXXXXXXXXXXXX 2022-06-21 XXXXXXXXXXXXXXX <XXXXXXXXXXXXXXX@example.com>
ãã®éµãéµãªã³ã°ããåé€ããŸãã? (y/N) y
åèæç®
- GitHub眲åä»ãã§ã³ãããããŠãã£ãã€ãã
- ã³ãããã«çœ²åãã - GitHub Docs
- ã€ã³ããŒãããGnuPGã®å ¬ééµãåé€ããã«ã¯ ïŒ ïŒ IT
- GPG ããŒãåé€ããæ¹æ³
- å ¬ééµãšç§å¯éµã®ãµã€ãºã«é¢ããèæ ®äºé - IBM Documentation
ⶠåç»
ä»åã®æé ãå®éã«ãã£ãŠã¿ãŸããð¥