Fetch a private github repo with Yocto recipe

I can successfully fetch and push from my private git repo using my generated ssh keys, but when I point my Yocto recipe to the same repo, I get an authentication error, as if it is not able to find the ssh keys during the Yocto build.

Any suggestions?

We have newer try to use Yocto with password protected repositories. I’d recommend to use a https://www.yoctoproject.org/community/ for help.

Actually, I managed to figure it out. I specified the SRC_URI in my recipe as follows:

git://git@blah.github.com/GitHubAccountName/repo-name.git

Then, in my .ssh/config file on my build machine, I specified which keys to use for a given Host, like this:

Host blah.github.com
Hostname github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_myprivatekeyfile

The key appears to be that the blah.github.com value in the SRC_URI must match a valid Host value in the .ssh/config file.

These two links gave me the clues I needed:

https://stackoverflow.com/questions/3225862/multiple-github-accounts-ssh-config

https://goinpaths.gitlab.io/post/yocto-tips/

Thanks for sharing a solution.

SRC_URI must include protocol=ssh. Here is how to clone repo from private GitLab when ssh is already configured on the machine:

SRC_URI += "git://git@private-gitlab.com:/root/project.git;protocol=ssh;branch=main"