3

I'm setting up a dev environment on 2 macs, the first one of which is running Gitea in a Docker container (see docker-compose below). I've setup an /etc/hosts entry on each mac for the hostname gitea and I have opened port 3333 on the first Mac using pfctl:

rdr pass log (all) on lo0 inet proto tcp from any to any port 3333 -> 127.0.0.1 port 3333

For simplicity I'm using HTTP for now and I can successfully browse to http://gitea:3333 from both machines. This proves that mac 2 can access gitea on mac 1 (via docker) over http.

I've made a git remote on each mac: http://gitea:3333/MyOrg/MyProject.git and I can git pull and push to the repo from the first mac but when I try to pull code via the second mac, I get the following error:

fatal: http://gitea:3333/MyOrg/MyProject.git/info/refs not valid: is this a git repository?

The git remote is connected using an account with write access from both machines.

The docker-compose.yml is as follows. I've tried docker compose version 2 and 3. I've created a static IP for the gitea container using a docker network. I've tried various combinations of adding hostname and extra_hosts but can't get the second mac to pull from the repo.

version: '2'

services:
  mariadb:
    image: mariadb
    restart: always
    environment:
      - ...
    volumes:
      - ./mariadb/data:/var/lib/mysql
    command:
      'mysqld --innodb-flush-method=fsync'
    networks:
      giteanet:
        ipv4_address: 172.0.0.11

  gitea:
    image: gitea/gitea
    volumes:
      - ./gitea/data:/data
    ports:
      - '3333:3000'
      - '2222:22'
    depends_on:
      - mariadb
    environment:
      - DB_TYPE=mysql
      - DB_HOST=mariadb:3306
      ...
      - APP_NAME='Gitea'
      - HOST=gitea
    restart: always
    networks:
      giteanet:
        ipv4_address: 172.0.0.10
    hostname: gitea

networks:
  giteanet:
    driver: bridge
    ipam:
      config:
        - subnet: 172.0.0.0/24
Daniel Flippance
  • 7,734
  • 5
  • 42
  • 55
  • 2
    did you try to run `curl http://gitea:3333/MyOrg/MyProject.git/info/refs` on the second Mac? sounds like a requests from a second Mac aren't routed properly to the docker – Yuri G. Feb 20 '20 at 05:10
  • I get a 200 doing `curl -I http://gitea:3333/MyOrg/MyProject.git` but a 405 Method Not Allowed on `curl -I http://gitea:3333/MyOrg/MyProject.git/info/refs` - I suppose GET is not allowed – Daniel Flippance Feb 20 '20 at 06:01
  • `curl -I` sends `HEAD`, check your config for `HEAD` requests restriction – Yuri G. Feb 20 '20 at 06:07
  • That helped me to see what the problem was - The user pulling from git was a valid user with creds on the project but it still had the `Must Change Password` setting. One of the curls showed a redirect to the .../changepassword page. Thanks for the help! – Daniel Flippance Feb 20 '20 at 06:08

0 Answers0