Skip to content

Commit 7261efc

Browse files
Merge pull request #3 from penguinranch/booting
feat: Enable SSH public key-based Git commit signing in the devcontai…
2 parents e37c70c + 3c41c04 commit 7261efc

4 files changed

Lines changed: 22 additions & 6 deletions

File tree

templates/.devcontainer/boot-check.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@ else
2323
if [ -n "${GIT_EMAIL:-}" ]; then
2424
git config --global user.email "$GIT_EMAIL"
2525
fi
26+
if [ -n "${SSH_PUBLIC_KEY:-}" ]; then
27+
git config --global gpg.format ssh
28+
git config --global user.signingkey "key::${SSH_PUBLIC_KEY}"
29+
git config --global commit.gpgsign true
30+
fi
2631
fi

templates/.devcontainer/devcontainer.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,8 @@
2929
}
3030
},
3131
"postAttachCommand": "code README.md AGENTS.md",
32-
"mounts": [
33-
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,readonly"
34-
],
3532
"containerEnv": {
3633
"GEMINI_API_KEY": "${localEnv:GEMINI_API_KEY}"
3734
},
38-
"remoteEnv": {
39-
"GIT_CONFIG_PARAMETERS": "'commit.gpgsign=true' 'gpg.format=ssh' 'user.signingkey=~/.ssh/id_ed25519.pub'"
40-
},
4135
"postStartCommand": "/bin/bash ./.devcontainer/boot-check.sh"
4236
}

templates/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# Git Configuration (for signing commits within container)
55
GIT_NAME=
66
GIT_EMAIL=
7+
SSH_PUBLIC_KEY=
78

89
# Gemini CLI API Key (for AI tooling inside the Devcontainer)
910
# Get your key at: https://aistudio.google.com/app/apikey

templates/scripts/setup-env.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ echo "Setting up environment variables..."
1616
read -p "Enter your Git Name: " GIT_NAME
1717
read -p "Enter your Git Email: " GIT_EMAIL
1818

19+
echo ""
20+
echo "Optional: SSH Public Key for commit signing."
21+
echo "If you use 1Password as your SSH agent, you can copy the public key string directly."
22+
echo "(e.g., ssh-ed25519 AAAAC3Nz...)"
23+
read -p "Enter your SSH Public Key (press Enter to skip): " SSH_PUBLIC_KEY
24+
1925
echo ""
2026
echo "Optional: The Gemini API Key is used by the Gemini CLI inside this Devcontainer."
2127
echo "You can get an API key from: https://aistudio.google.com/app/apikey"
@@ -50,10 +56,20 @@ update_env() {
5056
update_env "GIT_NAME" "$GIT_NAME"
5157
update_env "GIT_EMAIL" "$GIT_EMAIL"
5258

59+
if [ -n "$SSH_PUBLIC_KEY" ]; then
60+
update_env "SSH_PUBLIC_KEY" "$SSH_PUBLIC_KEY"
61+
fi
62+
5363
# Also configure git locally for the current environment
5464
git config --global user.name "$GIT_NAME"
5565
git config --global user.email "$GIT_EMAIL"
5666

67+
if [ -n "$SSH_PUBLIC_KEY" ]; then
68+
git config --global gpg.format ssh
69+
git config --global user.signingkey "key::${SSH_PUBLIC_KEY}"
70+
git config --global commit.gpgsign true
71+
fi
72+
5773
if [ -n "$GEMINI_API_KEY" ]; then
5874
update_env "GEMINI_API_KEY" "$GEMINI_API_KEY"
5975
fi

0 commit comments

Comments
 (0)