Rebase/stash not working after enabling GPG signing
Asked by AlecRust:

I've enabled GPG commit signing on the command line, and manually enabled via the "Repository Settings" section of SourceTree for each repo:

Screen Shot 2016-04-11 at 15.12.48.png

If I manually select "Sign commit" each time SourceTree correctly signs my commits:

Screen Shot 2016-04-11 at 15.16.48.png

However any other operation like stash or rebase doesn't seem to include the GPG options in the command and I get the following "gpg: cannot open \`/dev/tty': Device not configured" error:

Screen Shot 2016-04-11 at 15.18.41.png

I see you even have [a support article](https://confluence.atlassian.com/sourcetreekb/sourcetree-commits-fail-when-using-git-signed-commits-794199810.html) about this, but the proposed solution is [enabling GPG signing](https://confluence.atlassian.com/sourcetreekb/setup-gpg-to-sign-commits-within-sourcetree-765397791.html) in SourceTree which I've already done.  
[](https://community.atlassian.com/t5/Sourcetree-questions/Rebase-stash-not-working-after-enabling-GPG-signing/qaq-p/342198?attachment-id=7408){#link_1169420c6d05c6}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/10227/1/Screen%20Shot%202016-04-11%20at%2015.16.48.png){#display_1169420c6d05c6_0}  
[](https://community.atlassian.com/t5/Sourcetree-questions/Rebase-stash-not-working-after-enabling-GPG-signing/qaq-p/342198?attachment-id=7409){#link_1169420c6d05c6_0}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/10227/2/Screen%20Shot%202016-04-11%20at%2015.18.41.png){#display_1169420c6d05c6_2}  
[](https://community.atlassian.com/t5/Sourcetree-questions/Rebase-stash-not-working-after-enabling-GPG-signing/qaq-p/342198?attachment-id=7410){#link_1169420c6d05c6_1}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/10227/3/Screen%20Shot%202016-04-11%20at%2015.12.48.png){#display_1169420c6d05c6_4}


Answers:
author: Aditya Sanghi
body: ```
git config --global gpg.program gpg2
```

This maybe your answer.

comments: author: AlecRust
body: Thanks for your answer Aditya, I'm afraid I already have this set in my config though.


author: ahmed_hassanein
body: thanks!!


author: Scott Menzer
body: this did the trick for me, thanks!


author: noplanman
body: Remove the `gpgsign` attribute in the `[commit]` section of your `.gitconfig` if it's there.

This solved it for me.

comments: author: AlecRust
body: Won't that just disable GPG signing of commits by default? I'd like to keep this on, and think SourceTree should respect it.


author: noplanman
body: I have to manually select "Sign Commit" in SourceTree anyways, even with the attribute enabled.  

So I think it only takes effect for commits done via Terminal. Have you restarted SourceTree after modifying the config?


author: AlecRust
body: I have, and SourceTree doesn't respect this global git default. I'd rather not remove this since I want all commits to be signed - SourceTree should improve its GPG support.


author: noplanman
body: Absolutely, it would make more sense for them to enhance the software to respect the standards.

Honestly, I've stopped using stashes because of this issue, which is really annoying :-/ The workaround I proposed above is NOT viable at all.

Please Atlassian, make SourceTree work better with GPG!

edit: Check this out, worked perfectly for me!  
https://answers.atlassian.com/questions/38060409/answers/38398747


author: AlecRust
body: @Armando L?scher thank you for finding that and letting me know!!


author: Mat?? Kmi?
body: I confirm that I am having same issue with rebasing.

+1


author: AlecRust
body: Nope, I'm still having this issue. Please upvote/share to get it noticed!


author: noplanman
body: I'm having the same issue.

Disabling the key signing for the repository also doesn't help, I can't stash anything any more!

Any news on this?