greenpau / caddy-git

Git Plugin for Caddy v2
Apache License 2.0
70 stars 13 forks source link

question: How to change ssh port #25

Open eeRieee1 opened 11 months ago

eeRieee1 commented 11 months ago

I am using a self-hosted git server, the ssh port is not 22. How can I change it in Caddyfile?

greenpau commented 11 months ago

I am using a self-hosted git server, the ssh port is not 22. How can I change it in Caddyfile?

@Riddle233 , try changing it via url directive.

eeRieee1 commented 11 months ago
{
    git {
        repo docs {
            base_dir /var/www
            auth key /var/keys/id_ed25519
            url git@localhost:20002/xxx/doc.git
            branch web
        }
    }
}

and I got an error:

ERROR   git     failed managing repo    {"repo_name": "docs", "error": "invalid auth method"}
ERROR   git     failed configuring app instance {"app": "git", "error": "invalid auth method"}
greenpau commented 11 months ago

@Riddle233 , the "invalid auth method" is from your code repo, not the plugin itself. Check the logs for your git server.

eeRieee1 commented 11 months ago

Didn't get anything in gitea logs :(

greenpau commented 11 months ago

@Riddle233 , try running gitea with debugging enabled

eeRieee1 commented 11 months ago

Can i use username and password auth with http instead?

greenpau commented 11 months ago

@Riddle233 , I'd say tinker with it. Trace what is going on, e.g. is caddy-git makes a connection to gitea? What does it send? What does gitea respond with?

eeRieee1 commented 11 months ago

I tested it on my wsl with same caddyfile, it works locally, but didn't work on my nas (in docker), and I cannot get any log from gitea when I use it via docker my Dockerfile:

FROM caddy:builder AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/cloudflare \
    --with github.com/greenpau/caddy-git

FROM caddy:latest

COPY --from=builder /usr/bin/caddy /usr/bin/caddy