SSH passthrough to Docker doesn't work #13294

Closed
opened 2025-11-02 10:37:42 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @meyou69 on GitHub (Jul 16, 2024).

Description

Hello,

I'm having issues with the SSH passthrough to my gitea docker instance. I'm having a lot of issues with this, and I really don't know how to fix this.

Long story short, I tried to implement SSH passthrough for my installation, by following the guide at https://docs.gitea.com/installation/install-with-docker (specifically using the SSHing Shim methodology) and every time I try this, I come up empty handed.

I've already set up my SSH keys from the gitea website for my account, so authentication is not an issue.

What is an issue is that, whenever I try to do something like a "git clone git@transistor.one:Alex/python-scripts.git", it fails with an "Gitea: Invalid repo name" error, even though the repo name is correct. Moreover, whenever I do "git clone git@transistor.one:2200/Alex/python-scripts.git" instead (note the added port number), then everything works correctly.

Obviously the SSH passthrough isn't working correctly, but I checked and double checked and triple checked everything for the past two days, but I simply can't figure out what's wrong.

Can you please help?

Gitea Version

1.22.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

Ubuntu server

How are you running Gitea?

I'm running gitea from docker, using the following docker-compose.yml:

version: '2'

networks:
gitea:
external: false

services:
web:
image: gitea/gitea:latest
environment:
- USER_UID=1002
- USER_GID=1002
volumes:
- ./data:/data
- /home/git/.ssh/:/data/git/.ssh
ports:
- "3000:3000"
- "2200:22"
depends_on:
- db
restart: always
networks:
- gitea
db:
image: mariadb
restart: always
environment:
- MYSQL_ROOT_PASSWORD=
- MYSQL_DATABASE=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD=
volumes:
- ./db/:/var/lib/mysql
networks:
- gitea

Database

MySQL/MariaDB

Originally created by @meyou69 on GitHub (Jul 16, 2024). ### Description Hello, I'm having issues with the SSH passthrough to my gitea docker instance. I'm having a lot of issues with this, and I really don't know how to fix this. Long story short, I tried to implement SSH passthrough for my installation, by following the guide at https://docs.gitea.com/installation/install-with-docker (specifically using the SSHing Shim methodology) and every time I try this, I come up empty handed. I've already set up my SSH keys from the gitea website for my account, so authentication is not an issue. What is an issue is that, whenever I try to do something like a "git clone git@transistor.one:Alex/python-scripts.git", it fails with an "Gitea: Invalid repo name" error, even though the repo name is correct. Moreover, whenever I do "git clone git@transistor.one:2200/Alex/python-scripts.git" instead (note the added port number), then everything works correctly. Obviously the SSH passthrough isn't working correctly, but I checked and double checked and triple checked everything for the past two days, but I simply can't figure out what's wrong. Can you please help? ### Gitea Version 1.22.1 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System Ubuntu server ### How are you running Gitea? I'm running gitea from docker, using the following docker-compose.yml: version: '2' networks: gitea: external: false services: web: image: gitea/gitea:latest environment: - USER_UID=1002 - USER_GID=1002 volumes: - ./data:/data - /home/git/.ssh/:/data/git/.ssh ports: - "3000:3000" - "2200:22" depends_on: - db restart: always networks: - gitea db: image: mariadb restart: always environment: - MYSQL_ROOT_PASSWORD=<redacted> - MYSQL_DATABASE=gitea - MYSQL_USER=gitea - MYSQL_PASSWORD=<redacted> volumes: - ./db/:/var/lib/mysql networks: - gitea ### Database MySQL/MariaDB
GiteaMirror added the type/bug label 2025-11-02 10:37:42 -06:00
Author
Owner

@meyou69 commented on GitHub (Jul 16, 2024):

Hello,

I just wanted to say that I figured it out, myself.

The issue was that I added the git user's public key through the gitea website (which means that it created a standard "command=" entry for it in the authorized_keys file) rather than doing it properly, as shown in the guide that I just linked.

The most important part that made me realize about this was the:

Important: The pubkey from the git user needs to be added "as is" while all other pubkeys added via the Gitea web interface will be prefixed with command="/usr [...].

That part made me realize my mistake. The issue can be closed now

@meyou69 commented on GitHub (Jul 16, 2024): Hello, I just wanted to say that I figured it out, myself. The issue was that I added the git user's public key through the gitea website (which means that it created a standard "command=" entry for it in the authorized_keys file) rather than doing it properly, as shown in the guide that I just linked. The most important part that made me realize about this was the: > Important: The pubkey from the git user needs to be added "as is" while all other pubkeys added via the Gitea web interface will be prefixed with command="/usr [...]. That part made me realize my mistake. The issue can be closed now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13294