There's 3 different types of errors you might get when watching this video. Here's how to solve them. --- If you get fatal: failed to write commit object and you're using WSL 2 you'll want to add, export GPG_TTY="$(tty)" to your ~/.bashrc or equivalent file. --- If you're following along and get a "gpg failed to sign the data" error at 1:34, it will be resolved at 5:44. Turns out git will default to using your configured git email as a default gpg key if you don't explicitly set the signingkey option that we define at 5:44. I didn't know it did that at the time of recording the video. In my case it worked on video because my email address is the same for both values. Chances are it will work for you too, but if you happen to use different emails for both values then you will encounter the above error until you set your signingkey (which we do at 5:44). Thanks @stillFLiP for bringing this up in a comment! --- As of mid-2021 the default gpg key server went offline so the search / receive commands will likely fail unless you change your keyserver. I've been using Ubuntu's server. I've made this update on the blog post version of the video at nickjanetakis.com/blog/signing-and-verifying-git-commits-on-the-command-line-and-github. Search the page for "offline" and you'll find the update on how to customize your keyserver.
I dont mean to be offtopic but does anybody know a tool to get back into an instagram account?? I was dumb forgot my password. I would appreciate any help you can offer me!
Hi Nick! Thank you for the video! I have one follow-up question. I have two computers, the work computer and my personal computer. To sign my commits, do I need to create a GPG key in each computer? or it's enough to create one key and copy it to the other computer? is that even possible? Thank you!
Hi, no problem. You can export and import your key on a 2nd device as an "easy" solution. It'll work. Alternatively there's a deeper rabbit hole around creating subkeys but that's not something I ever explored.
I am using the WSL2 on windows 11, I've followed all the steps and even went further looking online but I seem not to be able to fix my issue. I am getting these error messages: error: gpg failed to sign the data fatal: failed to write commit object I've added everything in my .gitconfig file, sent the gpg key to the server using the new method in your blogpost but yet I am having this issue since, please can you help me with this?
Hi, Which WSL 2 distro are you using? What command are you running to produce the error? Also, I know this is asking a lot but do you happen to have a spare Windows 10 box where you can test this on? Just asking because I haven't used Windows 11 and it's hard to say if that's a variable here.
@@NickJanetakis Hello, thank you for replying to me, many don't and just ignore so thanks a lot. So I am using Ubuntu 20.04 LTS and I am using the $ git commit -S -m "msg" I thing the windows 11 and 10 work the same under the hood, just the design is different and a bit faster too.
@@mr.o5577 It should be ok, I am using zsh now and have no issues. I have to wonder if it's because GPG_TTY isn't set in your shell environment. What if you set this line in your .zshrc file? github.com/nickjj/dotfiles/blob/678765c7611af9e78a0fdb16a56b346429342407/.config/zsh/.zshrc#L102 , I have a feeling it's this.
There's 3 different types of errors you might get when watching this video. Here's how to solve them.
---
If you get fatal: failed to write commit object
and you're using WSL 2 you'll want to add, export GPG_TTY="$(tty)" to your ~/.bashrc or equivalent file.
---
If you're following along and get a "gpg failed to sign the data" error at 1:34, it will be resolved at 5:44.
Turns out git will default to using your configured git email as a default gpg key if you don't explicitly set the signingkey option that we define at 5:44. I didn't know it did that at the time of recording the video. In my case it worked on video because my email address is the same for both values. Chances are it will work for you too, but if you happen to use different emails for both values then you will encounter the above error until you set your signingkey (which we do at 5:44).
Thanks @stillFLiP
for bringing this up in a comment!
---
As of mid-2021 the default gpg key server went offline so the search / receive commands will likely fail unless you change your keyserver. I've been using Ubuntu's server. I've made this update on the blog post version of the video at nickjanetakis.com/blog/signing-and-verifying-git-commits-on-the-command-line-and-github. Search the page for "offline" and you'll find the update on how to customize your keyserver.
I'm macOS. I had to add this to get it working: export GPG_TTY=$(tty)
Oh wow, I was just looking at your Docker Flask repo when I found this. Small world!
Thank you for the video. It was very useful ❤
Man... this is gold. Thank you for making these. :) Greetings from Latvia. :)
No problem, happy to hear it was useful to you.
I dont mean to be offtopic but does anybody know a tool to get back into an instagram account??
I was dumb forgot my password. I would appreciate any help you can offer me!
@@uriahjeremiah174 Use your email to restore forgotten password or don't be an evil.
Thank you for the video! It was really helpful!
Hey Nick. Thanks for this. Helped me a lot! Got my sub!
No problem and welcome!
Sir you are awesome!! thank you so much
Thanks a lot for watching!
thank you so much, very well explained :)
Special thanks for you, thank you for you efforts very well explained
Hi Nick! Thank you for the video! I have one follow-up question. I have two computers, the work computer and my personal computer. To sign my commits, do I need to create a GPG key in each computer? or it's enough to create one key and copy it to the other computer? is that even possible? Thank you!
Hi, no problem. You can export and import your key on a 2nd device as an "easy" solution. It'll work. Alternatively there's a deeper rabbit hole around creating subkeys but that's not something I ever explored.
@@NickJanetakis thank you for the quick response! Ohh go it, thank you!
wow nick another great vid!
Thanks!
Thanks for this :)
ctrl L ?!
That would make life too easy.
I added gpg keys and followed the steps but they are still not verified
Did you update your gitconfig file to include the "user" file, or alternatively put those config settings in your gitconfig directly?
This helped getting Verified for my commits to GitHub, but when I run "get log --show-signature" I get "gpg: Can't check signature: No public key".
Did you import the public key of the person who signed the commit?
Turns out I didn't have gpg configured for git. I fixed it by running this command: git config --global gpg.program "
@@Lord0lives Ah. I didn't have to do that. What OS are you using?
I am using the WSL2 on windows 11, I've followed all the steps and even went further looking online but I seem not to be able to fix my issue. I am getting these error messages:
error: gpg failed to sign the data
fatal: failed to write commit object
I've added everything in my .gitconfig file, sent the gpg key to the server using the new method in your blogpost but yet I am having this issue since, please can you help me with this?
Hi, Which WSL 2 distro are you using? What command are you running to produce the error? Also, I know this is asking a lot but do you happen to have a spare Windows 10 box where you can test this on? Just asking because I haven't used Windows 11 and it's hard to say if that's a variable here.
@@NickJanetakis Hello, thank you for replying to me, many don't and just ignore so thanks a lot.
So I am using Ubuntu 20.04 LTS and I am using the $ git commit -S -m "msg"
I thing the windows 11 and 10 work the same under the hood, just the design is different and a bit faster too.
BTW i have zsh as my shell, would it affect it maybe?
@@mr.o5577 It should be ok, I am using zsh now and have no issues. I have to wonder if it's because GPG_TTY isn't set in your shell environment. What if you set this line in your .zshrc file? github.com/nickjj/dotfiles/blob/678765c7611af9e78a0fdb16a56b346429342407/.config/zsh/.zshrc#L102 , I have a feeling it's this.
@@NickJanetakis I will give it a try right now, thank you for taking the time. Be blessed man