Hi Nicolas,

Thanks for your answer.

That's great. Even I am building inside a docker container. I tried with creating a "config" file in .ssh directory. But I still have same issue.

Can you please let me know how to "forward SSH_AGENT into it to be able
to fetch from internal projects without the need to mount the key into the container."? I never did that before.

Thanks in advance.

On Fri, Jan 28, 2022, 10:42 Nicolas Jeker <n.jeker@delisys.ch> wrote:
On Tue, 2022-01-25 at 23:16 -0800, hrsourabh011@gmail.com wrote:
> I am trying to fetch a private gitlab repo within Yocto image recipe
> using SSH protocol. In my image recipe I have passed SRC_URI as:
>
> SRC_URI = " \
>         gitsm://git@git.example.com:2224/blah/blah/blah/blah;protocol
> =ssh;branch=master \
> "

I use almost the same, just without submodules.

SRC_URI =
"git://git@git.example.com:1234/group/project.git;protocol=ssh"

It should "just work" if ssh is able to find your key. I often build in
a docker container, so I have to forward SSH_AGENT into it to be able
to fetch from internal projects without the need to mount the key into
the container. I don't really have any insight for builds outside
docker, if git clone works, the bitbake fetcher should too.

> But this results in the error:
>
<snip>
>
> But I am able to clone the repo using git clone.
> SSH key is already added to the Gitlab. There is no config file in my
> ~/.ssh. Do I need to create a config file? What should be the content
> of the config file?

You should not need a ssh config file.

> Can anyone please let me know how to resolve this?
> Thanks in advance.