harness / gitness

Gitness is an Open Source developer platform with Source Control management, Continuous Integration and Continuous Delivery.
https://gitness.com
Apache License 2.0
31.89k stars 2.78k forks source link

docker git clone fatal: unable to update url base from redirection #3485

Open alex-dna-tech opened 3 months ago

alex-dna-tech commented 3 months ago

Steps to introduce

Follow Docs - Quick Start tutorial.

Result

clone

Cloning with 0 retries
Initialized empty Git repository in /gitness/.git/
+ git fetch origin +refs/heads/main:
fatal: unable to update url base from redirection:
asked for: http://host.docker.internal:3000/git/home/test.git/info/refs?service=git-upload-pack
redirect: http://pipeline:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTE0NzQ1OTYsImlhdCI6MTcxMTIxNTM5NiwiaXNzIjoiR2l0bmVzcyIsInBpZCI6MiwibXMiOnsicm9sZSI6ImNvbnRyaWJ1dG9yIiwic2lkIjoxfX0.some_JWT_Token@host.docker.internal:3000/login
alex-dna-tech commented 3 months ago

Related to #3462 , #3428

As default port 3000. It is required to define an external port for the environment explicitly if you need to change it. The Docker port map does not work.

docker run -d -p 8333:8333 -e GITNESS_HTTP_PORT=8333 -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/gitness:/data --name gitness --restart always harness/gitness:latest

http://host.docker.internal:3000/login redirection doesn't work for the git clone of the pipeline

alex-dna-tech commented 3 months ago

Some versions of docker require the definition of host.docker.internal with the parameter --add-host=host.docker.internal:host-gateway. It add host.docker.internal name to /etc/hosts file with internal docker gateway IP.