sameersbn / docker-gitlab

Dockerized GitLab
http://www.damagehead.com/docker-gitlab/
MIT License
7.9k stars 2.14k forks source link

can't clone or push with ssh #1225

Open ocean-7 opened 7 years ago

ocean-7 commented 7 years ago

First of all, I really appreciate your working!

I build gitlab container with docker-compose.yml. The key config is as follows.

gitlab:
    ports:
    - "10080:80"
    - "10022:22"
    - "10443:443"
environment
    - GITLAB_HOST=git.ifeixiu.com
    - GITLAB_PORT=443
    - GITLAB_SSH_PORT=22

This is my nginx.conf .

    server {
        listen      80;
        server_name  git.ifeixiu.com;
        rewrite ^(.*) https://$server_name$1 permanent;
    }

    server {
        listen       443;
        server_name  git.ifeixiu.com;

        ssl on;
        ssl_certificate "/usr/local/etc/nginx/git-ifeixiu-com.pem";
        ssl_certificate_key "/usr/local/etc/nginx/git-ifeixiu-com.key";
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;

        location / {
            # The IP of my vps is 47.91.164.148
            proxy_pass http://47.91.164.148:10080;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto https;
            proxy_set_header X-Forwarded-Ssl on;
        }
    }

Everything works well.

However, I meet a problem when I clone a repository.

dongpeihideMBP2:ccc urmyc$ git clone git@git.ifeixiu.com:ocean7/FeixiuAndroid.git
Cloning into 'FeixiuAndroid'...
git@git.ifeixiu.com's password: 

I've already add my SSH key to my profile. Why do I have to type in the password? And I don't know what the password exactly is.

looking forward to your help~

phpb-com commented 7 years ago

You are not specifying correct port in GITLAB_SSH_PORT, it should be 10022

mickaeltardy commented 7 years ago

I have similar issue. First I was unable to clone. Got it work after the following:

At this point git clone, git fetch started to work. However I'm still unable to perform the push.

I have public group and public project. Hence, the output is

Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 274 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: GitLab: You are not allowed to upload code for this project.
To ssh://git@{hostname}:10022/home/git/data/repositories/test/test-project.git/
 ! [remote rejected] develop -> develop (pre-receive hook declined)
error: failed to push some refs to     'ssh://git@{hostname}:10022/home/git/data/repositories/test/test-project.git/'

Prior to making the project public I had the message

GitLab: The Project You Were Looking For Could Not Be Found

Looks like gitlab doesn't get my identity right: ssh -T -p 10022 git@{hostname} doesn't show me the Welcome message as promised.

mickaeltardy commented 7 years ago

I just figured out what was happening.

The gitlab was indeed unable to get the identity for several reasons:

Removing the link solves the issue and creating .ssh owned by git user solve the issue.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had any activity for the last 60 days. It will be closed if no further activity occurs during the next 7 days. Thank you for your contributions.