Skip to content

Commit 3ba3183

Browse files
authored
Merge pull request #4 from lildude/use-ssh-commit-signing
Use ssh commit signing
2 parents ee5e361 + 3d65244 commit 3ba3183

File tree

6 files changed

+24
-10
lines changed

6 files changed

+24
-10
lines changed

chezmoi/.chezmoiignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ Library/
2828
.mozilla
2929
.netrc
3030
.secrets
31-
.ssh/
31+
.ssh/**
32+
!.ssh/
33+
!.ssh/allowed_signers
34+
!.ssh/git_signing_ed25519.pub
3235
dev
3336
tmp
3437
{{ end -}}

chezmoi/dot_config/git/config.tmpl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
useConfigOnly = true
1717
name = Colin Seymour
1818
19-
signingkey = 88109C73073E7080
19+
#signingkey = 88109C73073E7080
20+
signingkey = ~/.ssh/git_signing_ed25519.pub
2021

2122
# Override default when working in work repos
2223
[includeIf "hasconfig:remote.*.url:ssh://[email protected]/github/*"] # Requires git 2.36.0 later
@@ -127,11 +128,15 @@
127128
gpgSign = true
128129

129130
[gpg]
130-
{{- if .codespaces }}
131-
program = /.codespaces/bin/gh-gpgsign
132-
{{- else }}
133-
program = {{- lookPath "gpg" }}
134-
{{- end }}
131+
format = ssh
132+
# {{- if .codespaces }}
133+
# program = /.codespaces/bin/gh-gpgsign
134+
# {{- else }}
135+
# program = {{- lookPath "gpg" }}
136+
# {{- end }}
137+
138+
[gpg "ssh"]
139+
allowedSignersFile = ~/.ssh/allowed_signers
135140

136141
[merge]
137142
{{- $v := output "git" "--version" | trim | split " " }}{{ if semverCompare ">2.35.0" $v._2 }}

chezmoi/dot_ssh/allowed_signers

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[email protected],[email protected] namespaces="git" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMCyapwMY7+HjM6tOs/PS7s+VTtYRhcophPUauHMjm90
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{- onepasswordRead "op://Dotfiles/git_signing_ed25519/private key" }}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMCyapwMY7+HjM6tOs/PS7s+VTtYRhcophPUauHMjm90

script/codespaces-post-start

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ if [ "$(command -v rg)" = "" ]; then
1717
$sudo apt-get -q update && $sudo apt-get -q install -y ripgrep most gh
1818
fi
1919

20-
if [ -f "${HOME}/.netrc" ] && grep -q "goproxy.githubapp.com" "${HOME}/.netrc"; then
21-
exit 0
22-
else
20+
if [ ! -f "${HOME}/.netrc" ] || grep -vq "goproxy.githubapp.com" "${HOME}/.netrc"; then
2321
echo "machine goproxy.githubapp.com login nobody password $GITHUB_TOKEN" >> "$HOME/.netrc"
2422
fi
2523

24+
if [ ! -f "${HOME}/.ssh/git_signing_ed25519" ]; then
25+
# Takes this from my Codespaces secrets config on GitHub
26+
echo "$GIT_SIGNING_KEY" > "${HOME}/.ssh/git_signing_ed25519"
27+
chmod 600 "${HOME}/.ssh/git_signing_ed25519"
28+
fi

0 commit comments

Comments
 (0)