feat: download keys to ~/.ssh/git-commit-signing

pull/94/head
Phorcys 2 years ago
parent 326fafad02
commit 396078a6f1
No known key found for this signature in database

@ -15,7 +15,7 @@ if ! command -v jq > /dev/null; then
exit 1 exit 1
fi fi
mkdir -p ~/.ssh mkdir -p ~/.ssh/git-commit-signing
echo "Downloading SSH key" echo "Downloading SSH key"
@ -23,19 +23,19 @@ ssh_key=$(curl --request GET \
--url "${CODER_AGENT_URL}api/v2/workspaceagents/me/gitsshkey" \ --url "${CODER_AGENT_URL}api/v2/workspaceagents/me/gitsshkey" \
--header "Coder-Session-Token: ${CODER_AGENT_TOKEN}") --header "Coder-Session-Token: ${CODER_AGENT_TOKEN}")
jq --raw-output ".public_key" > ~/.ssh/coder.pub <<EOF jq --raw-output ".public_key" > ~/.ssh/git-commit-signing/coder.pub <<EOF
$ssh_key $ssh_key
EOF EOF
jq --raw-output ".private_key" > ~/.ssh/coder <<EOF jq --raw-output ".private_key" > ~/.ssh/git-commit-signing/coder <<EOF
$ssh_key $ssh_key
EOF EOF
chmod -R 400 ~/.ssh/coder chmod -R 400 ~/.ssh/git-commit-signing/coder
chmod -R 400 ~/.ssh/coder.pub chmod -R 400 ~/.ssh/git-commit-signing/coder.pub
echo "Configuring git to use the SSH key" echo "Configuring git to use the SSH key"
git config --global gpg.format ssh git config --global gpg.format ssh
git config --global commit.gpgsign true git config --global commit.gpgsign true
git config --global user.signingkey ~/.ssh/coder git config --global user.signingkey ~/.ssh/git-commit-signing/coder
Loading…
Cancel
Save