githubsshgitlabpodman

podman build from private repository with ssh


I would like to build an image directly from a private gitlab repository without cloning the this repository first. I found out that this is possible with:

podman build -t mytag https://gitlab.example.com/mygroup/myrepository#mybranch

Then I need to enter my credentials and podman seems to clone the repository temporally and build it. But I would like to use ssh to authenticate myself. So I'm looking for a command like:

podman build -t mytag git@gitlab.example.com:mygroup/myrepository#mybranch

I tried various addresses like

But podman responds either with

I understand the errors and it seems I didn't use the correct schema for the url with ssh protocol. Does anyone know, how to do it?

And I'm pretty sure, that it doesn't matter, if I'm using podman or docker and gitlab or github. I searched also solutions for docker and github, but I didn't find a solution.

Any ideas? Thanks in advance.


Solution

  • https://docs.podman.io/en/latest/markdown/podman-build.1.html#building-an-image-using-a-url-git-repo-or-archive

    Older versions of that page do give examples of the URL form you want to use. That one says

    Note: GitHub does not support using git:// for performing clone operation due to recent changes in their security guidance (https://github.blog/2021-09-01-improving-git-protocol-security-github/). Use an https:// URL if the source repository is hosted on GitHub

    I suspect gitlab and github watch each others security alerts and a similar change has happened with gitlab.