git - 在 Windows 上使用 sourcetree 提交签名

标签 git atlassian-sourcetree git-sign

目前(2018 年 2 月 13 日)Sourcetree 支持 commit signing in Mac version仅。

来自this question (自 2013 年起)提交签名在 Windows 版本中仍然不可用。

那么在 Windows 版本的 sourcetree 中是否可以签署提交?

最佳答案

嗯,答案是肯定的,也不是。

我想出的解决方法如下(我假设您已经设置了 GPG key ,如果没有请按照 github's tutorial on how to set it up 操作)

第 1 步为 Windows 安装 git shell

(如果你还没有)

第二步确保sourcetree使用系统的git

ctrl+,转到 git 选项卡并单击 Use System Git enter image description here

第 3 步配置 git 以签署每个提交(可选)

从 powershell(或者您可以使用 sourcetree 中 terminal 图标的内置终端)。

输入 git config commit.gpgsign true - 这会将 git 配置为自动签署当前存储库中的所有提交。

如果你想对EVERY repository 中的每个提交签名,使用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

除此之外,您可以照常使用 sourcetree 的所有其他功能(推送、 pull 、获取、 merge 等)。

编辑:ahmad's answer 解决了这个缺点.

关于git - 在 Windows 上使用 sourcetree 提交签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42675983/

相关文章:

git - 将 Bitbucket 转换为 Github

git - SourceTree 中的 git 子模块更新在哪里?

git - 什么是签名提交?

git - 使用 GPG 签署 git 提交

git - 将 Git 仓库转换为 Darc

GitHub:如何将打开的 pull 请求添加到本地仓库?

git pull 自动 merge

git - "at"@ sign/symbol/character 在 Git 中是什么意思?

git - 使用 SourceTree 的自定义操作脚本安装 Pod