0

I'm trying to set up a small Gitea server to play version control for the local network in my lab. However, I'm having trouble getting SSH to work as expected. I followed the docker installation documentation fairly closely, so this should be a rather standard, minimal install. It is effectively the only thing I have installed and running on an x86_64 machine running Ubuntu Server 22.04 LTS.

My docker-compose.yml file looks like this:

version: "3"

networks:
  gitea:
    external: false

services:
  server:
    image: gitea/gitea:latest
    container_name: gitea
    environment:
      - USER_UID=115
      - USER_GID=120
      - GITEA__database__DB_TYPE=postgres
      - GITEA__database__HOST=db:5432
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=gitea
      - GITEA__database__PASSWD=gitea
    restart: always
    networks:
      - gitea
    volumes:
      - ./gitea:/data
      - /home/git/.ssh/:/data/git/.ssh
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "127.0.0.1:2222:22"
    depends_on:
      - db

  db:
    image: postgres:latest
    restart: always
    environment:
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=gitea
      - POSTGRES_DB=gitea
    networks:
      - gitea
    volumes:
      - ./postgres:/var/lib/postgresql/data

The only nonstandard modifications here (other than the PostgreSQL ones) are those from the SSH shim documentation, which I tried under the assumption that they were what I needed for this. (Unfortunately they did not seem to change the behavior.)

Now, with the server running on a machine in my local network, I can navigate to http://server_local_IP:3000/ (192.168.1.230, in my case), and the web interface works fine. I can create accounts, organizations, and repositories. I can even add an SSH key on my user settings page and successfully verify it. However, when I try to connect to the server from a terminal (or pull a repository, etc) via ssh:

$ ssh -p 22 git@192.168.1.230
git@192.168.1.230's password:

...it requests a password, even though I have my ssh key loaded and ready to go in my local ssh agent! (I don't actually even know what password it wants here, as it refuses my gitea account password, the gitea admin password, the git user password, and the password for my local ssh agent.)

What I should see is something like Hi there, You've successfully authenticated, but Gitea does not provide shell access. rather than a password prompt. Can anyone point me in the right direction? I'm totally lost on this.

Apologies if I didn't explain anything quite properly; I'm not a real sysadmin, pretty much just figuring all of this out as I go along. (I'd never once even used docker until this project, hah!) (And if this is too far off-topic for stackoverflow, is there a better stackexchange I should try instead?)

twieg
  • 53
  • 2
  • 9

0 Answers0