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 connect: connection refused
To (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'
    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
      - web
      - ./data/gitea:/data
      - "3000:3000"
      - "22:22"
      - "traefik.enable=true"
      - "traefik.backend=gitea"
      - ""
      - ""
      - "traefik.port=3000"
      - db

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

    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’@‘’ (using password: YES)

So I quit and used the sqlite instead of mysql.

This is my yml:

    image: gitea/gitea:1.9.3
      - 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
      - service
      - ./gitea:/data
      - "2020:22"
      - giteadb

    image: postgres:9.6.15
    restart: always
      - POSTGRES_USER=gitea
      - POSTGRES_DB=gitea
      - ./giteadb:/var/lib/postgresql/data
      - 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


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 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: