I’ve read other answers to issues trying to do an SSH clone with Gogs and attempted to apply suggested fixes all to no avail. What makes this a bit different is the way I’m doing things.
My GOGS is a container in Docker (I used docker-compose to build it) and here is the compose file I am using for the curious.
version: "3" services: gogs: hostname: git domainname: berghold.net build: gogs restart: always networks: middleware: ipv4_address: 22.214.171.124 backend: ipv4_address: 126.96.36.199 ports: - "9024:22" - "3000:3000" volumes: - /data:/data gogs_db: hostname: gogs-db domainname: docker.berghold.net image: local-mariadb:latest build: gogs-db volumes: - gogs_db_data:/var/lib/mysql networks: backend: ipv4_address: 188.8.131.52 restart: always environment: MYSQL_ROOT_PASSWORD: <redacted> MYSQL_DATABASE: <censored> MYSQL_USER: gogs MYSQL_PASSWORD: <nopeitsasecret> volumes: gogs_db_data: networks: middleware: external: name: "middleware" backend: external: name: "backend"
One reason I’m bothering post that is note the mapping for the SSH port for the gogs engine itself. I’ve got the host port 9024 mapped to the container port 22. I made sure my front end firewall is passing 9024 into the container and so far as I can tell it is.
I tried cloning with HTTP and all is hunky-dory but I do not want to use HTTP (in fact I’m considering disabling HTTP) I want to use SSH. Ultimately Jenkins is going to be talking to the repositories on this host.
So I try SSH thusly:
$ git clone firstname.lastname@example.org:9024/peter/testapp.git Cloning into 'testapp'... Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
well… that didn’t work. Previously I uploaded my keys to Gogs that work fine on BitBucket (want to move from there) with all my repos there.
I guess my question is there something special I need to do to make it work within Docker?
The Gogs Docker image was built from gogs/gogs:latest.