Moved Gitea to new Docker host, SSH no longer works

I was running Gitea on a NUC via docker for a long time, then just this past week the hard drive started making horrible noises. So I shutdown the containers, backed up the volumes and configuration files, and moved them to a new Docker NUC I had been prepping but hadn’t implemented yet. I’ve got almost everything back online, but I’ve found I cannot SSH into Gitea to git pull or git clone via SSH. Git clone via HTTPS is working.

I’ve removed and re-applied my SSH public key via my profile settings a couple times, and tried to update the authorized users file via the admin settings. But I still cannot connect. I have tried doing direct Putty SSH connections and git SSH connections, both a no go. The Docker logs don’t seem to show anything specific. I also tried changing my SSH port for Gitea from 22 to 2221 to make sure I wasn’t having some sort of overlap (even though I was using port mapping 2221:22 previously).

Here’s the related docker-compose section:

# git server
    image: "gitea/gitea:latest"
    container_name: "gitea"
     - USER_UID=1000
     - USER_GID=1000
     - SSH_PORT=2221
     - SSH_LISTEN_PORT=2221
     - "2221:2221"
     - /srv/gitea/data:/data
     - /etc/timezone:/etc/timezone:ro
     - /etc/localtime:/etc/localtime:ro
    restart: always

Any ideas on where to go next?

hmm… good question. I just checked my compose file and I did my mapping via “22:4444” and that works like a charm. have you tried accessing the port from your nuc? did you try to telnet the port? telnet yourserver 2221 or maybe with a port-scanner?

Either networking is screwed up, or gitea does not initialize properly. In the first case, tcpdump is your friend, and in the second, I’d try strace. You will probably need to modify the gitea container, though.

What happens when you try to git clone via SSH, as in what are the specific errors you are receiving?