Build with private repository from bitbucket fails (submodules)

Hey guys. Is here anyone who uses private bitbucket repository in their code?
We have this kind of weird approach and need to use our repository in package.json ("quickjobs-api-wrapper": "bitbucket:quickjobs/api-js#73b4e0bc05261ad4c960ce9ddf5c40e368831313",) but when i try to build, my pre-install hook shows me this error.

I tried couple of approaches → store private key in base64, store it raw as file and as string aswell. But every time it ends the same.
So my question is: can someone guide me like step by step what to do? I have my public key set in bitbucket repository (Access keys) and my private key in expo secrets. And i dont really know what to do next.

I also tried to generate new private key and do the whole process again (as @Kim mentioned to me on discord). Added the new public key to bitbucket Access keys and store the private key in secrets (organization secret, raw, not base64) but the result is the same again.

According to docs (Using Git Submodules - Expo Documentation) this is how my pre-install file looks like:

#!/usr/bin/env bash

mkdir -p ~/.ssh

echo "$BUCKET_KEY" > ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/

ssh-keyscan >> ~/.ssh/known_hosts

git submodule update --init

It looks like that the worker instance is not a git repository. So should i do git init at first in my pre-install file?

Thanks for help.

OK i found a solution. After i generated whole new private key, i added the public key to bitbucket’s Access Tokens.
Then i pasted the private key to expo secrets as text in raw format (including the end of line).
I had error saying not a git repository.

So i added git init before git submodule update and it worked.