简体   繁体   中英

Unable to clone repository from gitlab (docker behind traefik reverse proxy)

Recently I've built an docker container with gitlab behind an traefik revers proxy container. I was easily able to log in via https. But when I try to clone a repository with intellij (or git bash) I get the error

ssh: connect to host git.domain.de port 22: Connection refused
fatal: Could not read from remote repository.

The docker-compose file sets the ports:

ports:
  - 80
  - 22:22

And Traefik is just listening on port 80 and 443.

So has anybody any idea what is causing this problem or how to track it? Why can I log into the web UI but can't clone any repository? The logs doesn't give any information of refused connections or errors. But if it is helpfull then I can upload some logs here.

So has anybody any idea what is causing this problem or how to track it?

There is something wrong with your network configuration. Your git client cannot reach your gitlab installation on port 22.

Why can I log into the web UI but can't clone any repository? Because you use 80/443 ports for your web UI, but you use port 22 for cloning with your git client.

If you do not mind cloning over https, and gitlab supports it, you might try that. If you want to get cloning over SSH working, you need to troubleshoot your port 22 connection. Depending on your network configuration it could be anywhere.

Here are some things you might want to try:

  • Ensure that gitlab is listening on 22
  • Ensure you can connect to gitlab on port 22 from inside gitlab docker container
  • Ensure you can connect to gitlab on port 22 from the docker host from outside of a docker container
  • Ensure that you can connect to gitlab on port 22 from the same machine you are running git client from

Clearly one of those will fail. When it does, you will have to identify the reason for that, and fix the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM