我在Git 2.10发行说明中关于漂亮属性的文章很少.继续将git升级到2.10.0并对全局进行更改,结果如下 -.gitconfig
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[user]
name = xyz
email = abc.def@gmail.com
signingkey = AAAAAAA
[core]
excludesfile = /Users/xyz/.gitignore_global
editor = 'subl' --wait
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
[color "diff"]
old …Run Code Online (Sandbox Code Playgroud) 在GitHub上,我想添加一个密钥以将我的计算机与我的帐户关联,我有两个选择:创建SSH或GPG密钥.
两把钥匙有什么区别?是否有一个首选使用?
我理解如何通过遵循网站上的指南来创建两者,但我不知道哪一个更好用.
我从brew安装了GPG.
brew install gpg
Run Code Online (Sandbox Code Playgroud)
这是gnupg2-2.0.30_2.
当我提交时,我收到一条错误消息:
You need a passphrase to unlock the secret key for
user: "Max Mustermann (mycomment) <mm@test.de>"
2048-bit RSA key, ID 1111AAAA, created 2017-01-05
error: gpg failed to sign the data
fatal: failed to write commit object
Run Code Online (Sandbox Code Playgroud)
我使用了命令:
gpg --list-secret-keys | grep ^sec
Run Code Online (Sandbox Code Playgroud)
它让我回来:
sec 2048R/1111AAAA 2017-01-05
Run Code Online (Sandbox Code Playgroud)
然后我用这个命令:
git config --global user.signingkey 1111AAAA
Run Code Online (Sandbox Code Playgroud)
commit给了我相同的错误消息.
我怎么解决这个问题?
如果我将我的 Git 设置为使用我的 GPG 密钥签名,它就会失败。我试过 GIT_TRACE 并没有真正给我更多信息:
$ GIT_TRACE=1 git commit
15:29:35.112157 git.c:344 trace: built-in: git 'commit'
15:29:35.115745 run-command.c:626 trace: run_command: 'code --wait' '/Users/b/VurbAgency/haarlem.github.io/.git/COMMIT_EDITMSG'
15:29:52.884006 run-command.c:626 trace: run_command: 'gpg' '--status-fd=2' '-bsau' 'SECRETKEYID'
error: gpg failed to sign the data
fatal: failed to write commit object
Run Code Online (Sandbox Code Playgroud)
当我尝试运行'gpg' '--status-fd=2' '-bsau' 'SECRETKEYID'它时,它只是在说完之后挂起BEGIN_SIGNING H8并且不再做任何事情。
关于如何解决这个问题或研究途径的任何想法?
我正在尝试在 OS X Mojave 上启用提交签名。
git commit -S -am "Test"
Run Code Online (Sandbox Code Playgroud)
错误是:
error: gpg failed to sign the data
fatal: failed to write commit object
Run Code Online (Sandbox Code Playgroud)
我试过的:
gpg工作正常(见下文),没有安装gpg1或gpg2 pinentrygpg2 --clearsign 工作正常(为文件生成一个新的 .asc 文件,为纯文本输出文本)我调查并尝试了所有选项的问题:
我究竟做错了什么?
我在大部分编程工作中使用 git,并在大部分提交中使用 SSH 密钥对其进行签名。但是,当我将 git 更新到版本 2.17.1 时,git 默认使用 GPG 密钥而不是 SSH 密钥进行签名。
我想知道使用 GPG 密钥相对于 SSH 密钥有哪些优点和缺点,以及为什么 git 将 GPG 设置为默认密钥。
根据 git,您现在可以使用现有的 ssh 密钥对提交进行签名。
https://github.blog/2021-11-15-highlights-from-git-2-34/#tidbits
接下来:https://unix.stackexchange.com/questions/269188/use-my-ssh-key-to-sign-git-commits。
我也一直在浏览这个文档: https: //git-scm.com/docs/git-config#Documentation/git-config.txt-gpgprogram,但目前还不清楚如何使用它。
我已将 gpg 格式设置为 ssh 并将签名设置为 true,因此目前它正在尝试对其进行签名但失败。我相信我还需要设置 user.signingKey 但我不知道格式是什么,即git config --global user.signingKey <what-is-supposed-to-go-here>?
我还有第二个问题。如果一年后我格式化我的电脑并丢失了我的密钥,我将无法验证这些提交是否仍然属于我。除了将密钥转储到某个在线驱动器中(无论如何我都可能会丢失它)之外,是否有一个好的标准将该密钥保存在某个地方?
编辑:我至少设法让 gpg 工作。以下:Git 错误 - gpg 无法签署数据,我的 gpg 崩溃了:
gpg: signing failed: Inappropriate ioctl for device gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device
然后使用 Maven 在 MacOS 上添加export GPG_TTY=$(tty)到 bash,从“gpg:签名失败:设备的 ioctl 不合适”,最终为我工作,所以它至少使用 gpg 对其进行签名。
编辑:以为我设法让它工作,但没有。按照https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generate-a-new-ssh-key-and-adding-it-to-the-ssh-agent,我创建了一个新的 ed25519 ssh 密钥。
之后你需要git config --global gpg.format "ssh" …
我在签署我的提交时遇到错误git commit -S -m 'test'并收到以下错误:
error: gpg failed to sign the data
fatal: failed to write commit object
Run Code Online (Sandbox Code Playgroud)
我已经尝试过这个解决方案,但仍然无法正常工作。
也尝试过这个,但仍然一无所获。
我有配备最新 macOS 的 Macbook Pro 2017。
有没有其他解决方案可以修复它并正确地将我的提交提交到 Github 或 Gitlab?
我在签署提交时遇到麻烦。使用以下git config:
user.name=Bob
user.email=[bob's email]
user.signingkey=ABCDEFGH
user.user=bob1
gpg.program=gpg2
Run Code Online (Sandbox Code Playgroud)
有人告诉我只包含密钥的前八个字符。
暂存后,在时git commit -S -m "commit message",我收到以下错误:
error: gpg failed to sign the data
fatal: failed to write commit object
Run Code Online (Sandbox Code Playgroud)
似乎大多数遇到此错误的用户都在Mac上,并且需要做一些额外的设置。但是我在使用Kali Linux。
有什么建议吗?