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 Community Overview – Yocto Project 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"

Is there any way to provide username and password for git repo in SRC_URI using https protocol?

Regards,
Prathamesh Kulkarni

Hi @prathamesh.kulkarni,

Have you tried something like the following?

SRC_URI = "git://git@bitbucket.org/myworkspace/myrepo.git;protocol=https;user=myusername:my-app-password;"

Although this is for Bitbucket, you can try to add “user=” at the end of the link.

More information on SRC_URI: 5 Variables Glossary — Bitbake dev documentation

Please, if you have more questions regarding this issue, can you open a new ticket? This is an old ticket and it’s already solved.

Best Regards,
Hiago.