go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.95k stars 5.48k forks source link

Support SSH alias users #20568

Open tecosaur opened 2 years ago

tecosaur commented 2 years ago

Feature Description

After setting Gitea up under a gitea user and group, it can be desirable to be able to use git@example.com:user/repo.git. This can be enabled by creating a git user with the same UID, e.g. via useradd -o -u $(id -u gitea) git.

At the moment, this causes issues because the user check is based on the name, not the UID.

https://github.com/go-gitea/gitea/blob/ff9b6fa6639bacd4770b0e81661697af35c78aa6/modules/setting/setting.go#L999-L1005

https://github.com/go-gitea/gitea/blob/ff9b6fa6639bacd4770b0e81661697af35c78aa6/modules/setting/setting.go#L512-L523

Would it be possible to change this check to be based on the UID?

Screenshots

No response

balki commented 2 years ago

I am using the Builtin ssh server. The service is running as gitea. If I set git for SSH_USER, it does not work. It only works if SSH_USER is also gitea.