Ambigious doc on SSH Container Passthrough/Docker Shell #9583

Open
opened 2025-11-02 08:43:42 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @IamIpanda on GitHub (Sep 17, 2022).

Description

On section Docker Shell, it set the fake gitea as:

/usr/bin/docker exec -i -u git --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea sh "$@"

And origin authorized_keys is

command="/app/gitea/gitea --config='/data/gitea/conf/app.ini' serv key-1"

So that will combine to

+ /usr/bin/docker exec -i -u git --env SSH_ORIGINAL_COMMAND=xxxxx gitea sh --config=/data/gitea/conf/app.ini serv key-1

And get a
sh: can't open 'serv': No such file or directory

Is that the fake gitea

/usr/bin/docker exec -i -u git --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea sh "$@"

the sh should be $0?

Or, you can get it work by change authorized_keys or set AuthorizedKeysCommand, but that's not mentioned in that section.

Gitea Version

N/A

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

N/A

Screenshots

N/A

Git Version

No response

Operating System

No response

How are you running Gitea?

Docker

Database

PostgreSQL

Originally created by @IamIpanda on GitHub (Sep 17, 2022). ### Description On section [Docker Shell](https://docs.gitea.io/en-us/install-with-docker/#docker-shell-with-authorized_keys), it set the fake gitea as: ``` /usr/bin/docker exec -i -u git --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea sh "$@" ``` And origin authorized_keys is ``` command="/app/gitea/gitea --config='/data/gitea/conf/app.ini' serv key-1" ``` So that will combine to ``` + /usr/bin/docker exec -i -u git --env SSH_ORIGINAL_COMMAND=xxxxx gitea sh --config=/data/gitea/conf/app.ini serv key-1 ``` And get a `sh: can't open 'serv': No such file or directory` Is that the fake gitea ``` /usr/bin/docker exec -i -u git --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea sh "$@" ``` the `sh` should be `$0`? Or, you can get it work by change `authorized_keys` or set `AuthorizedKeysCommand`, but that's not mentioned in that section. ### Gitea Version N/A ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist N/A ### Screenshots N/A ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Docker ### Database PostgreSQL
GiteaMirror added the type/bug label 2025-11-02 08:43:42 -06:00
Author
Owner

@evlist commented on GitHub (Feb 14, 2024):

I have the same issue (serv not found) migrating an older version to 1.21.5.
The command sent to the container appears to be "serv" when it should be "gitea serv" since there seems to be no "serv" executable and I got the following script working:

#!/bin/sh
shift
/usr/bin/docker exec -i -u git --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea gitea $@

I am still not understanding why it doesn't work with the versions copied from the docs ;) ...

@evlist commented on GitHub (Feb 14, 2024): I have the same issue (serv not found) migrating an older version to 1.21.5. The command sent to the container appears to be "serv" when it should be "gitea serv" since there seems to be no "serv" executable and I got the following script working: ``` #!/bin/sh shift /usr/bin/docker exec -i -u git --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea gitea $@ ``` I am still not understanding why it doesn't work with the versions copied from the docs ;) ...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9583