在Windows上使用sourcetree提交签名

the*_*746 8 git atlassian-sourcetree git-sign

目前(2018年2月13日)Sourcetree仅支持在Mac版本中提交签名.

这个问题(自2013年以来)提交签名仍然不适用于Windows版本.

那么有可能在Windows版的sourcetree中签名提交吗?

ahm*_*mad 15

我有一个类似的问题,我按照@theiner3746的答案来设置它.

我能够修复no tty错误并有一个对话框,可以使用以下步骤输入密码

  • 安装:https://www.gpg4win.org
  • 将密钥加载到Kleopatra程序中 ([Your homedir]/.gnupg/secring.gpg)
  • 在终端中运行此命令: git config --global gpg.program "c:\Program Files (x86)\GnuPG\bin\gpg.exe"


the*_*746 14

嗯,答案是肯定的,不是.

我已经想到的工作如下(我假设你已经有了GPG密钥设置,如果不遵循github的教程如何设置它)

步骤1为Windows安装git shell

(如果你还没有)

步骤2确保sourcetree使用系统的git

ctrl+,转到git选项卡并单击Use System Git在此输入图像描述

步骤3配置git以对每次提交进行签名(可选)

来自powershell(或者您可以使用terminalsourcetree中图标的内置终端).

输入git config commit.gpgsign true- 这将配置git以自动签署CURRENT存储库中的所有提交.

如果您想在每个存储库中使用每个提交进行签名git config --global commit.gpgsign true.


注意如果您选择跳过步骤3,请确保-S每次提交时都添加(git commit -S),否则您的提交将不会签名.


退税

当然这种方式有一个缺点.

每次你提交.你必须在终端做.如果您尝试使用sourcetree的提交按钮提交,则会发生错误

gpg: cannot open tty `no tty': No such file or directory
error: gpg failed to sign the data
fatal: failed to write commit object
Run Code Online (Sandbox Code Playgroud)

除此之外,您可以像往常一样使用sourcetree的所有其他功能(推送,拉取,获取,合并等).

编辑:艾哈迈德的答案解决了这个缺点.