Git push fails on my gitea (traefik)

I am trying to figure out how to get this work.

I am using traefik and docker-compose.

The image starts well

remote: Gitea: Internal Server Error
remote: Unable to contact gitea: Get http://localhost:443/api/internal/hook/pre-receive/theuser/testi?old=be5f5dde25b8c68043a2bf83f9a21e09f8fc76e4&new=72d2ba5d1474250b783b8f7f310f1c3b904b877a&ref=refs%!F(MISSING)heads%!F(MISSING)master&userID=1&gitObjectDirectory=%!F(MISSING)data%!F(MISSING)git%!F(MISSING)repositories%!F(MISSING)theuser%!F(MISSING)testi.git%!F(MISSING).%!F(MISSING)objects%!F(MISSING)incoming-GJhJGa&gitAlternativeObjectDirectories=%!F(MISSING)data%!F(MISSING)git%!F(MISSING)repositories%!F(MISSING)theuser%!F(MISSING)testi.git%!F(MISSING).%!F(MISSING)objects&gitQuarantinePath=%!F(MISSING)data%!F(MISSING)git%!F(MISSING)repositories%!F(MISSING)theuser%!F(MISSING)testi.git%!F(MISSING).%!F(MISSING)objects%!F(MISSING)incoming-GJhJGa&prID=0: dial tcp 127.0.0.1:443: connect: connection refused
To https://git.example.xyz/master/testi.git (confiscated by me)

I thought it was because of
Domain or host address for SSH clone URLs.

Reinstalled quite many times… but not sure where might be the problem.

I am using Traefik and used sqlite as the database as didnt know the right value for Database Settings hosts. But I am not sure what causes this problem. Why its trying to push into localhost.

would you mind posting your compose file?

Hi Spencer!

version: '3'
services:
  app:
    image: gitea/gitea:latest
    restart: always    environment:      - USER_UID=1000
      - USER_GID=1000      - DB_TYPE=mysql      - DB_HOST=db:3306
      - DB_NAME=gitea
      - DB_USER=gitea
      - DB_PASSWD=gitea
    networks:
      - web
    volumes:
      - ./data/gitea:/data
    ports:
      - "3000:3000"
      - "22:22"
    labels:
      - "traefik.enable=true"
      - "traefik.backend=gitea"
      - "traefik.docker.network=web"
      - "traefik.frontend.rule=Host:git.examplesite.xyz"
      - "traefik.port=3000"
    depends_on:
      - db

  db:
    image: mariadb:10
    networks:
      - web
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=gitea
      - MYSQL_DATABASE=gitea
      - MYSQL_USER=gitea
      - MYSQL_PASSWORD=gitea
    volumes:
      - ./db/:/var/lib/mysql

networks:
  web:
    external: true

I tried the database Settings

username- database name should be gitea but what should I fill to the Host? I tried like gitea, db, db:3306 etc but I still get

The database settings are invalid: Error 1045: Access denied for user ‘gitea’@‘172.18.0.4’ (using password: YES)

So I quit and used the sqlite instead of mysql.

This is my yml:

  gitea:
    image: gitea/gitea:1.9.3
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - DB_TYPE=postgres
      - DB_HOST=services_giteadb_1:5432
      - DB_NAME=gitea
      - DB_USER=gitea
      - DB_PASSWD=xxx
    restart: always
    networks:
      - service
    volumes:
      - ./gitea:/data
    ports:
      - "2020:22"
    depends_on:
      - giteadb

  giteadb:
    image: postgres:9.6.15
    restart: always
    environment:
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=xxx
      - POSTGRES_DB=gitea
    volumes:
      - ./giteadb:/var/lib/postgresql/data
    networks:
      - service

this is my composer-part for gitea. Is port 22 used by your host machine? If you want to use port 3000 for the trafic I think you can just use it via traefik. I found a docker-compose.yml here on the forum, maybe it helps you:


Did you already initialized gitea? What was your domain?

1 Like

Hi!

Thanks for the reply.

I am going to try it later.

      - DB_HOST=services_giteadb_1:5432

Is this something that can come up with yourself? Is this the value that should be put into the Host -section on the initialization section on Gitea?

My ssh uses different port so 22 fits fine.

I am more fiddled about why the error contains localhost:443 instead of the right address.

remote: Unable to contact gitea: Get http://localhost:443/api/internal/hook/pre-receive/theuser/testi?old=be5f5dde25b8c68043a2bf83f9a21e09f8fc76e4&new=72d2ba5d1474250b783b8f7f310f1c3b904b877a&

I put git.examplesite.xyz as example as I am not releasing my sites yet.

I worked with docker swarm for quite a while and my stack is named services therefore services_giteadb_1. giteadbis sufficient as well.

I am a bit stumped about that message too. Otherwise you post the server part of your app.ini.

Hey Buddy! Spencer!!!

It works… I could pull and push from and to my server… It feels good that this finally worked.

Tho I have the problem with ssh when I try to pull

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

But I guess its another problem as this main thing is solved!! Thanks maan!

Glad to hear that your setup is working now.

Regarding that error message, I get the same error message when I delete my ssh-key in gitea.
Did you add your key to gitea?

Yeah that was the problem haha… I thought it could work without using any keys

Great, so everything works now :smiley: