[{"data":1,"prerenderedAt":445},["ShallowReactive",2],{"i-lucide:sun-moon":3,"i-lucide:menu":8,"post-\u002Fblog\u002F2025-04-23-signing-git-commits-with-ssh-keys":10,"surround-\u002Fblog\u002F2025-04-23-signing-git-commits-with-ssh-keys":428,"i-lucide:arrow-left":439,"i-lucide:sparkles":441,"i-lucide:user":443},{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":7},0,24,false,"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M12 2v2m2.837 12.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715M16 12a4 4 0 0 0-4-4m7-3l-1.256 1.256M20 12h2\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":9},"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 5h16M4 12h16M4 19h16\"\u002F>",{"id":11,"title":12,"authors":13,"body":16,"date":415,"description":22,"extension":416,"meta":417,"navigation":420,"path":421,"seo":422,"stem":423,"tags":424,"toc":6,"__hash__":427},"blog\u002Fblog\u002F2025-04-23-signing-git-commits-with-ssh-keys.md","Signing git commits with SSH keys",[14,15],"gpt","pfarmer",{"type":17,"value":18,"toc":404},"minimark",[19,23,28,31,49,52,56,69,79,111,115,122,135,138,142,145,181,188,192,195,214,217,232,236,239,285,298,302,305,320,323,371,375,393,397,400],[20,21,22],"p",{},"Git commit signing is a great way to prove the authenticity of your commits. While GPG has long been the standard, SSH signing is a newer and simpler alternative that uses the SSH keys you may already use for authentication. In this guide, we’ll walk through setting up SSH signing for Git on your local machine.",[24,25,27],"h2",{"id":26},"why-sign-git-commits","Why Sign Git Commits?",[20,29,30],{},"Signed commits ensure that:",[32,33,34,43,46],"ul",{},[35,36,37,38,42],"li",{},"The commit was made by ",[39,40,41],"em",{},"you",".",[35,44,45],{},"The commit hasn’t been tampered with.",[35,47,48],{},"Other collaborators can verify your identity.",[20,50,51],{},"This is especially important in open-source projects or collaborative teams where trust and traceability matter.",[24,53,55],{"id":54},"prerequisites","Prerequisites",[32,57,58,66],{},[35,59,60,61,65],{},"Git 2.34+ (run ",[62,63,64],"code",{},"git --version"," to check)",[35,67,68],{},"An existing SSH key pair (or create one)",[20,70,71,75,76],{},[72,73],"binding",{"value":74},"\u003C warning >","If you don’t already have an SSH key, you can generate one:",[72,77],{"value":78},"\u003C \u002Fwarning >",[80,81,86],"pre",{"className":82,"code":83,"language":84,"meta":85,"style":85},"language-bash shiki shiki-themes github-light github-dark-default","ssh-keygen -t ed25519 -C \"your_email@example.com\"\n","bash","",[62,87,88],{"__ignoreMap":85},[89,90,93,97,101,105,108],"span",{"class":91,"line":92},"line",1,[89,94,96],{"class":95},"sYRkA","ssh-keygen",[89,98,100],{"class":99},"sPgVT"," -t",[89,102,104],{"class":103},"sNbzA"," ed25519",[89,106,107],{"class":99}," -C",[89,109,110],{"class":103}," \"your_email@example.com\"\n",[24,112,114],{"id":113},"_1-find-your-ssh-public-key","1. Find Your SSH Public Key",[20,116,117,118,121],{},"First, locate your SSH public key (usually in ",[62,119,120],{},"~\u002F.ssh","):",[80,123,125],{"className":82,"code":124,"language":84,"meta":85,"style":85},"cat ~\u002F.ssh\u002Fid_ed25519.pub\n",[62,126,127],{"__ignoreMap":85},[89,128,129,132],{"class":91,"line":92},[89,130,131],{"class":95},"cat",[89,133,134],{"class":103}," ~\u002F.ssh\u002Fid_ed25519.pub\n",[20,136,137],{},"You'll need this for the next step.",[24,139,141],{"id":140},"_2-add-the-ssh-key-to-git-as-a-signing-key","2. Add the SSH Key to Git as a Signing Key",[20,143,144],{},"Tell Git to use your SSH key for signing:",[80,146,148],{"className":82,"code":147,"language":84,"meta":85,"style":85},"git config --global gpg.format ssh\ngit config --global user.signingkey ~\u002F.ssh\u002Fid_ed25519.pub\n",[62,149,150,167],{"__ignoreMap":85},[89,151,152,155,158,161,164],{"class":91,"line":92},[89,153,154],{"class":95},"git",[89,156,157],{"class":103}," config",[89,159,160],{"class":99}," --global",[89,162,163],{"class":103}," gpg.format",[89,165,166],{"class":103}," ssh\n",[89,168,170,172,174,176,179],{"class":91,"line":169},2,[89,171,154],{"class":95},[89,173,157],{"class":103},[89,175,160],{"class":99},[89,177,178],{"class":103}," user.signingkey",[89,180,134],{"class":103},[20,182,183,184,187],{},"Replace ",[62,185,186],{},"~\u002F.ssh\u002Fid_ed25519.pub"," with the path to your actual SSH public key if different.",[24,189,191],{"id":190},"_3-enable-commit-signing","3. Enable Commit Signing",[20,193,194],{},"You can configure Git to sign all commits by default:",[80,196,198],{"className":82,"code":197,"language":84,"meta":85,"style":85},"git config --global commit.gpgsign true\n",[62,199,200],{"__ignoreMap":85},[89,201,202,204,206,208,211],{"class":91,"line":92},[89,203,154],{"class":95},[89,205,157],{"class":103},[89,207,160],{"class":99},[89,209,210],{"class":103}," commit.gpgsign",[89,212,213],{"class":99}," true\n",[20,215,216],{},"Or enable it per repository:",[80,218,220],{"className":82,"code":219,"language":84,"meta":85,"style":85},"git config commit.gpgsign true\n",[62,221,222],{"__ignoreMap":85},[89,223,224,226,228,230],{"class":91,"line":92},[89,225,154],{"class":95},[89,227,157],{"class":103},[89,229,210],{"class":103},[89,231,213],{"class":99},[24,233,235],{"id":234},"_4-make-a-signed-commit","4. Make a Signed Commit",[20,237,238],{},"Create a test commit to verify everything works:",[80,240,242],{"className":82,"code":241,"language":84,"meta":85,"style":85},"echo \"test\" > test.txt\ngit add test.txt\ngit commit -S -m \"Test commit with SSH signing\"\n",[62,243,244,259,268],{"__ignoreMap":85},[89,245,246,249,252,256],{"class":91,"line":92},[89,247,248],{"class":99},"echo",[89,250,251],{"class":103}," \"test\"",[89,253,255],{"class":254},"sDgYj"," >",[89,257,258],{"class":103}," test.txt\n",[89,260,261,263,266],{"class":91,"line":169},[89,262,154],{"class":95},[89,264,265],{"class":103}," add",[89,267,258],{"class":103},[89,269,271,273,276,279,282],{"class":91,"line":270},3,[89,272,154],{"class":95},[89,274,275],{"class":103}," commit",[89,277,278],{"class":99}," -S",[89,280,281],{"class":99}," -m",[89,283,284],{"class":103}," \"Test commit with SSH signing\"\n",[20,286,287,290,291,294,295],{},[72,288],{"value":289},"\u003C info >"," The ",[62,292,293],{},"-S"," flag tells Git to sign the commit.",[72,296],{"value":297},"\u003C \u002Finfo >",[24,299,301],{"id":300},"_5-verify-the-signature","5. Verify the Signature",[20,303,304],{},"You can verify a commit with:",[80,306,308],{"className":82,"code":307,"language":84,"meta":85,"style":85},"git log --show-signature\n",[62,309,310],{"__ignoreMap":85},[89,311,312,314,317],{"class":91,"line":92},[89,313,154],{"class":95},[89,315,316],{"class":103}," log",[89,318,319],{"class":99}," --show-signature\n",[20,321,322],{},"You should see something like:",[80,324,326],{"className":82,"code":325,"language":84,"meta":85,"style":85},"gpg: Signature made ...\ngpg:                using EDDSA key ...\nGood signature from \"Your Name \u003Cyour_email@example.com>\"\n",[62,327,328,342,357],{"__ignoreMap":85},[89,329,330,333,336,339],{"class":91,"line":92},[89,331,332],{"class":95},"gpg:",[89,334,335],{"class":103}," Signature",[89,337,338],{"class":103}," made",[89,340,341],{"class":103}," ...\n",[89,343,344,346,349,352,355],{"class":91,"line":169},[89,345,332],{"class":95},[89,347,348],{"class":103},"                using",[89,350,351],{"class":103}," EDDSA",[89,353,354],{"class":103}," key",[89,356,341],{"class":103},[89,358,359,362,365,368],{"class":91,"line":270},[89,360,361],{"class":95},"Good",[89,363,364],{"class":103}," signature",[89,366,367],{"class":103}," from",[89,369,370],{"class":103}," \"Your Name \u003Cyour_email@example.com>\"\n",[24,372,374],{"id":373},"troubleshooting-tips","Troubleshooting Tips",[32,376,377,380,383,390],{},[35,378,379],{},"If signing fails, double-check the key path.",[35,381,382],{},"Ensure your Git version supports SSH signing (2.34+).",[35,384,385,386,389],{},"Make sure your SSH key has the correct permissions (",[62,387,388],{},"chmod 600 ~\u002F.ssh\u002Fid_ed25519",").",[35,391,392],{},"GitHub will only show the \"Verified\" badge if your signing key is added to your profile.",[24,394,396],{"id":395},"youre-signed-and-secure","You're Signed and Secure!",[20,398,399],{},"That’s it! Your commits are now cryptographically signed using your SSH key, offering both security and simplicity.",[401,402,403],"style",{},"html pre.shiki code .sYRkA, html code.shiki .sYRkA{--shiki-default:#6F42C1;--shiki-dark:#FFA657}html pre.shiki code .sPgVT, html code.shiki .sPgVT{--shiki-default:#005CC5;--shiki-dark:#79C0FF}html pre.shiki code .sNbzA, html code.shiki .sNbzA{--shiki-default:#032F62;--shiki-dark:#A5D6FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sDgYj, html code.shiki .sDgYj{--shiki-default:#D73A49;--shiki-dark:#FF7B72}",{"title":85,"searchDepth":270,"depth":270,"links":405},[406,407,408,409,410,411,412,413,414],{"id":26,"depth":169,"text":27},{"id":54,"depth":169,"text":55},{"id":113,"depth":169,"text":114},{"id":140,"depth":169,"text":141},{"id":190,"depth":169,"text":191},{"id":234,"depth":169,"text":235},{"id":300,"depth":169,"text":301},{"id":373,"depth":169,"text":374},{"id":395,"depth":169,"text":396},"2025-04-23","md",{"type":418,"layout":419},"post","blog_page",true,"\u002Fblog\u002F2025-04-23-signing-git-commits-with-ssh-keys",{"title":12,"description":22},"blog\u002F2025-04-23-signing-git-commits-with-ssh-keys",[425,154,426],"devops","ssh","9-kVaN6hitEDcM-zD5YkDvT_i_ZlUjQLXwRsDD3qIjs",[429,434],{"title":430,"path":431,"stem":432,"date":433,"children":-1},"Using Git Tags: A Practical Guide","\u002Fblog\u002F2025-11-26-using-git-tags","blog\u002F2025-11-26-using-git-tags","2025-01-15",{"title":435,"path":436,"stem":437,"date":438,"children":-1},"Installing Debian Trixie in WSL Using Docker","\u002Fblog\u002F2026-01-16-installing-debian-trixie-wsl-docker","blog\u002F2026-01-16-installing-debian-trixie-wsl-docker","2026-01-16",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":440},"\u003Cpath fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m12 19l-7-7l7-7m7 7H5\"\u002F>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":442},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Cpath d=\"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594zM20 2v4m2-2h-4\"\u002F>\u003Ccircle cx=\"4\" cy=\"20\" r=\"2\"\u002F>\u003C\u002Fg>",{"left":4,"top":4,"width":5,"height":5,"rotate":4,"vFlip":6,"hFlip":6,"body":444},"\u003Cg fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\">\u003Cpath d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\"\u002F>\u003Ccircle cx=\"12\" cy=\"7\" r=\"4\"\u002F>\u003C\u002Fg>",1783616164385]