How to change SSh git clone url?

Hello

suggest, please, a solution.

There is a gitea docker container with forwarded SSH port, 2222:22.

How to change rendered git clone url for ssh from

git@domain.com:username/demoproject.git

to

ssh://git@domain.com:2222/username/demoproject.git

I have a similar issue that I asked here.

My app.ini

[server]
ROOT_URL         = https://example.com
SSH_PORT         = 2222
SSH_LISTEN_PORT  = 2222
SSH_DOMAIN       = example.com
START_SSH_SERVER = true

For me it shows like this:

ssh://git@example.com:2222/username/test.git
1 Like

Thank @lonix1 you, it works.

2 Likes

My pleasure.

There are a number of ways to setup ssh. Are you using the “separate port option” - ssh on port 22, and another port for gitea container?

If yes, I’m still struggling with that. Where did you find your working config?

@lonix1

I am playing with own docker compose config.

I have not time and hurry, and have made a decision to get the simplest possible way - run SSH alongside with Gitea container. Generally, it’s wrong - SSH must be separated container. But it’s not so bad as to forward host SSH - we need some virtualization due to security and reliability concerns.

I have added to config

SSH_PORT         = 2222
SSH_LISTEN_PORT  = 2222
START_SSH_SERVER = true

check remaining options, and it works.

In docker-compose.yaml I have written simple

    expose:
      - 3000
    ports:
      - 2222:2222
1 Like

You have no idea how helpful this was!

I was able to do the same thing simply doing a port mapping in captain rover from 22 to 22, which allowed me to setup remote deploys, but I wouldn’t have thought of that without this post.

Thank you!