hlassiege/panopliepublic Fork
⑂ 8f750be
Commits
⬇ Clone ▾
git clone https://git.rickub.com/hlassiege/panoplie.git
git clone ssh://git@rickub.com/hlassiege/panoplie.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

chore: fix mirror configuration

hlassiege committed 2026-11-07T19:48:55+01:00 Browse files
8f750be parent: 960623f
modified .rickub/workflows/mirror-github.yml +23 -1
@@ -34,10 +34,32 @@ jobs:
3434 - name: Push to GitHub
3535 env:
3636 SSH_KEY: ${{ secrets.GH_MIRROR_SSH_KEY }}
37+ shell: bash
3738 run: |
3839 mkdir -p ~/.ssh
39- printf '%s\n' "$SSH_KEY" > ~/.ssh/mirror_key
40+
41+ # A key pasted from Windows carries CRLF line endings, and some secret stores flatten newlines
42+ # into spaces or literal \n: OpenSSH then fails with "error in libcrypto". Rebuild the PEM layout
43+ key=$(printf '%s' "$SSH_KEY" | tr -d '\r')
44+ key=${key//\\n/$'\n'}
45+ header=$(grep -oE -- '-----BEGIN [A-Z ]+-----' <<< "$key" || true)
46+ if [[ -n $header && $key != *$'\n'* ]]; then
47+ footer=$(grep -oE -- '-----END [A-Z ]+-----' <<< "$key")
48+ body=${key#"$header"}
49+ body=${body%"$footer"}
50+ key=$(printf '%s\n' "$header"; tr ' ' '\n' <<< "$body" | sed '/^$/d'; printf '%s\n' "$footer")
51+ fi
52+ printf '%s\n' "$key" > ~/.ssh/mirror_key
4053 chmod 600 ~/.ssh/mirror_key
54+
55+ # Fail early with a readable diagnosis (header and line count only, never the key itself)
56+ if ! ssh-keygen -y -f ~/.ssh/mirror_key > /dev/null; then
57+ first=$(head -n 1 ~/.ssh/mirror_key)
58+ [[ $first == -----* || $first == ssh-* ]] || first="(neither a PEM header nor a public key)"
59+ echo "GH_MIRROR_SSH_KEY is not a usable private key: $(wc -l < ~/.ssh/mirror_key) lines, first line: ${first:0:40}"
60+ echo "Expected the private key, without passphrase, from -----BEGIN OPENSSH PRIVATE KEY----- to -----END OPENSSH PRIVATE KEY-----"
61+ exit 1
62+ fi
4163 echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" > ~/.ssh/known_hosts
4264 export GIT_SSH_COMMAND="ssh -i ~/.ssh/mirror_key -o IdentitiesOnly=yes"
4365
@@ -34,10 +34,32 @@ jobs:
34 - name: Push to GitHub34 - name: Push to GitHub
35 env:35 env:
36 SSH_KEY: ${{ secrets.GH_MIRROR_SSH_KEY }}36 SSH_KEY: ${{ secrets.GH_MIRROR_SSH_KEY }}
37+ shell: bash
37 run: |38 run: |
38 mkdir -p ~/.ssh39 mkdir -p ~/.ssh
39- printf '%s\n' "$SSH_KEY" > ~/.ssh/mirror_key40+
41+ # A key pasted from Windows carries CRLF line endings, and some secret stores flatten newlines
42+ # into spaces or literal \n: OpenSSH then fails with "error in libcrypto". Rebuild the PEM layout
43+ key=$(printf '%s' "$SSH_KEY" | tr -d '\r')
44+ key=${key//\\n/$'\n'}
45+ header=$(grep -oE -- '-----BEGIN [A-Z ]+-----' <<< "$key" || true)
46+ if [[ -n $header && $key != *$'\n'* ]]; then
47+ footer=$(grep -oE -- '-----END [A-Z ]+-----' <<< "$key")
48+ body=${key#"$header"}
49+ body=${body%"$footer"}
50+ key=$(printf '%s\n' "$header"; tr ' ' '\n' <<< "$body" | sed '/^$/d'; printf '%s\n' "$footer")
51+ fi
52+ printf '%s\n' "$key" > ~/.ssh/mirror_key
40 chmod 600 ~/.ssh/mirror_key53 chmod 600 ~/.ssh/mirror_key
54+
55+ # Fail early with a readable diagnosis (header and line count only, never the key itself)
56+ if ! ssh-keygen -y -f ~/.ssh/mirror_key > /dev/null; then
57+ first=$(head -n 1 ~/.ssh/mirror_key)
58+ [[ $first == -----* || $first == ssh-* ]] || first="(neither a PEM header nor a public key)"
59+ echo "GH_MIRROR_SSH_KEY is not a usable private key: $(wc -l < ~/.ssh/mirror_key) lines, first line: ${first:0:40}"
60+ echo "Expected the private key, without passphrase, from -----BEGIN OPENSSH PRIVATE KEY----- to -----END OPENSSH PRIVATE KEY-----"
61+ exit 1
62+ fi
41 echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" > ~/.ssh/known_hosts63 echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" > ~/.ssh/known_hosts
42 export GIT_SSH_COMMAND="ssh -i ~/.ssh/mirror_key -o IdentitiesOnly=yes"64 export GIT_SSH_COMMAND="ssh -i ~/.ssh/mirror_key -o IdentitiesOnly=yes"
43 65