Gitea SSH w/ Traefik reddit / selfhosted ---------------------------------------------------------------------- SillyLilBear · 2023-11-21 13:06 I can't seem to figure this out. I tried setting up a traefik service for 2222, exposing port 2222:22 for gitea, as well as a lot of other things. I can't even get it to work using 2222 in the git remote. Ideally I want to use no port number in the git: url. Is there a way to do this without the shim nonsense? `gitea:` `image: gitea/gitea:latest` `container_name: gitea` `environment:` `USER_UID: 1000` `USER_GID: 1000` `GITEA__database__DB_TYPE: postgres` `GITEA__database__HOST: gitea-db:5432` `GITEA__database__NAME: gitea` `GITEA__database__USER: gitea` `GITEA__database__PASSWD: ---` `restart: unless-stopped` `networks:` `- gitea` `- proxy` `ports:` `- 2222:22` `volumes:` `- ~/volumes/gitea:/data` `- ~/volumes/gitea-ssh:/data/git/.ssh` `- /etc/timezone:/etc/timezone:ro` `- /etc/localtime:/etc/localtime:ro` `depends_on:` `- gitea-db` `labels:` [`homepage.group`](https://homepage.group)`: Tools` [`homepage.name`](https://homepage.name)`: Gitea` `homepage.icon: gitea.png` `homepage.href:` [`https://git`](https://git.ramp.dedyn.io) `homepage.description: Git Server` `traefik.enable: true` `traefik.http.routers.gitea.rule: Host(\`git\`)` `traefik.http.services.gitea.loadbalancer.server.port: 3000` `traefik.http.routers.gitea.entrypoints: websecure` `traefik.http.routers.gitea.tls.certresolver: myresolver` [`traefik.docker.network`](https://traefik.docker.network)`: proxy` `nautical-backup.stop-before-backup: false` ​ ---------------------------------------------------------------------- NiftyLogic · 2023-11-21 14:16 Why SSH and not HTTPS like everyone else? ---------------------------------------------------------------------- budy-love · 2023-11-21 14:28 Hi, this works for me very well. ​ `- "traefik.http.services.gitea-web- svc.loadbalancer.server.port=3000"- "traefik.tcp.routers.gitea- ssh.rule=HostSNI(\`\*\`)"- "traefik.tcp.routers.gitea- ssh.entrypoints=ssh"- "traefik.tcp.routers.gitea-ssh.service=gitea- ssh-svc"- "traefik.tcp.services.gitea-ssh- svc.loadbalancer.server.port=22"\` ---------------------------------------------------------------------- SillyLilBear · 2023-11-21 14:30 I don't want to have to specify username/password all the time. ---------------------------------------------------------------------- waeking · 2023-11-21 14:40 I have not used this but here is an example. https://community.traefik.io/t/help-setting-up-gitea-with-ssh/17148/13 ---------------------------------------------------------------------- from-nibly · 2023-11-21 14:46 Are you asking how do you make it so you don't have to add a port when running git clone? Like git clone git@gitea:521:foo/bar? If that then your ssh needs to listen on 22 If you don't want to listen on 22 then you need to set up an ssh config on the client that says when you say to this host use this non standard port. You can use a fake host if you like "gitea-git" that will resolve in the ssh config Something like HOST gitea-git Hostname gitea Port 521 Then "got clone git@gitea-git:foo/bar ---------------------------------------------------------------------- tankerkiller125real · 2023-11-21 14:48 There are on occasion issues with HTTPS that SSH doesn't have issues with (notably super large repositories in the multi-gig range tend to just work better on SSH. ---------------------------------------------------------------------- SillyLilBear · 2023-11-21 15:00 Yes, I am trying to make it so I can git clone/git remote without ports. Because I am running it on docker, with port 22 used by my docker host, I am not sure the best way to do it. I didn't know .ssh/config actually affected git commands. That's interesting.