feat .gitconfig: signingkey GPG簽名綁定

This commit is contained in:
Yuan Chiu 2025-05-07 04:30:17 +08:00
parent cee037e8dd
commit 7de43b89a5
Signed by: yuan
GPG Key ID: 50FBE4156404B98D
4 changed files with 18 additions and 2 deletions

View File

@ -1,5 +1,6 @@
{{- $name := promptStringOnce . "name" "請輸入您的姓名" -}}
{{- $email := promptStringOnce . "email" "輸入您的Email地址" -}}
{{- $signingkey := promptStringOnce . "signingkey" "輸入您的GPG金鑰ID (可從 gpg --list-secret-keys --keyid-format=long 去找)" -}}
{{- $hosttype_choices := list "desktop" "server" "unroot_server" "manual" -}}
{{- $hosttype := promptChoice "What type of host are you on" $hosttype_choices -}}
@ -32,6 +33,7 @@ sourceDir = "~/.local/share/chezmoi"
[data]
name = {{ $name | quote }}
email = {{ $email | quote }}
signingkey = {{ $signingkey | quote }}
serverStyle = {{ $isServer }}
unRootMode = {{ $unRootMode }}
enableSixel = {{ $enableSixel }} {{/* TODO: packages.toml還沒處理 */}}

View File

@ -220,6 +220,9 @@ function __pb10k_bottom {
# ----以下是我的自訂內容 ------------------------------------------------------
export LANG=zh_TW.UTF-8 #macOS要手動指定不然被ssh連入使用時會變亂碼
{{ if .signingkey }}
export GPG_TTY=$(tty){{ end }}
# overwrite ls
if command -v eza &> /dev/null; then
alias ls='eza --color=always --icons=always'

View File

@ -3,9 +3,16 @@
smudge = git-media-smudge %f
[user]
name = {{ .name | quote }}
email = {{ .email | quote }}
email = {{ .email | quote }}{{ if .signingkey }}
signingkey = {{ .signingkey | quote }}{{ end }}
{{ if .signingkey }}
[commit]
gpgsign = true
[tag]
gpgSign = true
{{ end }}
[core]
editor = vim
excludesfile = {{ joinPath .chezmoi.homeDir ".gitignore_global" }}
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"

View File

@ -189,6 +189,10 @@ test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell
export PATH="$PATH:$HOME/bin"
zinit light mass8326/zsh-chezmoi
{{ if .signingkey }}
export GPG_TTY=$TTY{{ end }}
gpgconf --launch gpg-agent
# 自動補上 noglob 並禁用 Zsh 的 globbing 解析
function git_pushmulti() {
# 手動處理方括號或括號內容,並進行推送