🪟 Windows TippsModify Windows Support Phone Number with PowerShell(03.09.2026 um 00:00 Uhr)
🔧 AI Nachrichten Podcast: ChatGPT schwatzt Nutzern in Deutschland jetzt Werbung auf(28.08.2026 um 08:46 Uhr)
🪟 Windows TippsMicrosoft bringt Emoji 17.0 auf Windows 11(31.08.2026 um 08:16 Uhr)
🪟 Windows TippsModify Windows Support Phone Number with PowerShell(03.09.2026 um 00:00 Uhr)
🔧 AI Nachrichten Podcast: ChatGPT schwatzt Nutzern in Deutschland jetzt Werbung auf(28.08.2026 um 08:46 Uhr)
🪟 Windows TippsMicrosoft bringt Emoji 17.0 auf Windows 11(31.08.2026 um 08:16 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 6 Min Lesezeit
0

Git -> GitHub -> GPG Key (Windows)

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

If you're a beginner to Git or just starting to tinker with GitHub and GPG, you're probably here because you want to get that super-cute green "Verified" label next to your commits. The one that makes your contributions look professional and trusted. But, like most of us, you might have run into a few snags while setting up GPG keys on Windows. Don’t worry—you're not alone!



In this guide, I'll walk you through the entire process of setting up GPG for signing your GitHub commits on Windows. Plus, I’ll show you how I fixed a few tricky issues along the way. So, grab your coffee, and let's dive into it.






Step 1: Install Git Bash



Before we get into the GPG configuration, let's talk about Git Bash. Git Bash is a terminal emulator that comes with Git for Windows. If you haven’t installed it yet, do yourself a favor and install it. You can get it from the .



After installation, make sure GPG is accessible by running the following command in Git Bash:




CODE
gpg --version






This should return the version number of GPG if it’s properly installed. If you get an error, go back to the installation and make sure it went smoothly.






Step 3: Generate a GPG Key



Next, let’s generate your GPG key. This is the key that will be used to sign your Git commits.




  1. Run the following command in Git Bash to create your GPG key:




CODE
   gpg --full-generate-key







  1. Choose the default options (RSA and RSA, key size 4096, etc.), and when asked for your name and email, use the same email that you have registered with GitHub.



You should see something like this:




CODE
   Real name: Your Name
Email address: [email protected]






Important: Make sure the email you enter matches the one on your GitHub account. If it doesn't, GitHub won’t be able to associate your commits with your account.




  1. Once the key is generated, list your keys to find the key ID:




CODE
   gpg --list-secret-keys --keyid-format LONG






This will output a long string with your key ID. It should look something like this:




CODE
   sec   rsa4096/XXXXXXXXXXXXXXXX 2024-12-01 [SC] [expires: 2027-12-01]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
uid [ultimate] Your Name <[email protected]>
ssb rsa4096/XXXXXXXXXXXXXXXX 2024-12-01 [E] [expires: 2027-12-01]






Copy your key ID from the rsa4096/XXXXXXXXXXXXXXXX part. You'll need it for later.






Step 4: Add Your GPG Key to Git



Now that your GPG key is ready, let's tell Git to use it for signing commits. First, export the public key to add it to GitHub:




CODE
gpg --armor --export [email protected]






This will print your public GPG key in ASCII format. Copy the entire output (starting with -----BEGIN PGP PUBLIC KEY BLOCK----- and ending with -----END PGP PUBLIC KEY BLOCK-----).



Next, add this key to GitHub:




  1. Go to your GitHub account and navigate to Settings > SSH and GPG Keys > New GPG Key.

  2. Paste your public key into the box and save it.






Step 5: Configure Git to Use Your GPG Key



Let’s tell Git to use your GPG key when signing commits. Run the following command in Git Bash:




CODE
git config --global user.signingkey your-key-id






Replace your-key-id with the GPG key ID you copied earlier.



Then, configure Git to automatically sign your commits by default:




CODE
git config --global commit.gpgSign true






This ensures that every commit you make will be signed automatically.






Step 6: Test Your Setup



You’re almost there! Now, let’s test if everything is working properly. Try making a commit in any of your repositories:




  1. Make a small change to a file and commit it:




CODE
   git commit -m "Test commit"







  1. Push the commit to GitHub:




CODE
   git push







  1. Check GitHub. If everything is set up correctly, you should now see the "Verified" label next to your commit on GitHub!






Common Issues & Fixes



Okay, so you followed all the steps, but you’re still facing some issues? I’ve been there, and I’ve got you covered with a couple of extra fixes.






Problem 1: "No 'Verified' label?" – Even After Everything Looks Fine



The Issue:


If you’re getting the GPG key to work locally but don’t see the "Verified" label on GitHub, there’s a chance the problem lies in how you're using the terminal.



The Fix:


In Windows, PowerShell can be tricky when it comes to handling environment variables like GPG_TTY, which is necessary for GPG to function properly. The solution is to either set the environment variable correctly in PowerShell or switch to Git Bash.



Here’s what worked for me:





  1. In PowerShell, set the GPG_TTY environment variable with this command:



CODE
   $env:GPG_TTY = "COM1"





Alternatively, you can point directly to the gpg.exe executable:




CODE
   $env:GPG_TTY = "C:/Program Files (x86)/GnuPG/bin/gpg.exe"








  1. Switch to Git Bash (if you're still facing issues). Git Bash works more naturally with Unix-style commands, including setting environment variables with export. In Git Bash, run:




CODE
   export GPG_TTY=$(tty)






This should resolve most issues with signing commits in Git.






Problem 2: GPG Errors on Windows – "No Secret Key"



The Issue:


This error usually means Git can’t find your GPG private key for signing commits.



The Fix:





  1. Check where GPG is installed using:



CODE
   where gpg





This should show you the path to your gpg.exe. Make sure it's pointing to the correct version, usually located in C:\Program Files (x86)\GnuPG\bin\gpg.exe.





  1. Configure Git to use the correct GPG version:



If Git is pointing to the wrong GPG version, set it explicitly with:




CODE
   git config --global gpg.program "C:/Program Files (x86)/GnuPG/bin/gpg.exe"








  1. Double-check your GPG key with:




CODE
   gpg --list-secret-keys --keyid-format LONG






Make sure your key appears. If it doesn’t, you’ll need to import it into your keyring.









Wrapping Up



Setting up GPG on Windows for GitHub commit signing can be a bit tricky, but once you’ve got everything in place, it’s totally worth it to see that “Verified” label next to your commits.



Just remember to use Git Bash to avoid some of the headaches with PowerShell and to set the correct environment variables. If you're running into GPG errors or issues with secret keys, double-check your paths and keys, and you should be good to go!



Happy coding, and enjoy the satisfaction of seeing your verified commits on GitHub! If you have any other issues or tips to share, drop a comment or tweet at me. Let's make this process smoother for everyone.



My Social Links: | |

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Modify Windows Support Phone Number with PowerShell
1 Quelle
Die Zukunft des Einkaufens: Warum wir ein neues Kapitel aufschlagen (und wie du es mitschreiben kannst)
1 Quelle
ZDE Podcast 251: Wie sieht digitales Instore Marketing 2026 aus, Amit Chatterjee?
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Git -> GitHub -> GPG Key (Windows)

Thematisch verwandte Begriffe: GitHub, Windows · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...