Error loading key "/dev/fd/63": error in libcrypto

138 views Asked by At

I am trying to push a file to GH repo from pipeline and failing at ssh-add $private_key / ssh-add <(cat git-private-key | base64 --decode)

git config --global user.name "CI Bot"
git config --global user.email "localhost"
eval $(ssh-agent -s)
echo -e $private_key | base64 -w0 > git-private-key
ssh-add <(cat git-private-key | base64 --decode)

enter image description here

I tried other solutions and things like eval ssh-agent, update libcrypto, chmod 600 file permission, and passing key in plane and base64 format, but I am getting the same error.

Pls find the below ss trying multiple ways enter image description here

1

There are 1 answers

0
Rajat jain On

After some debugging I have it fixed by correcting the way it is being referenced in ssh-add.

I have used sed to update the $private_key before ssh-add

echo -e $private_key | sed 's/--- /---\n/g;s/ ----/\n----/g' | sed '2s/ /\n/g' > git-private-key

This makes sure that private_key will have a correct format earlier

----beginkey---- KEY SECRET DATA IN MULTIPLE LINES ----endkey----

After sed command

----beginkey----
KEY SECRET DATA
----endkey----