unable to git through ssh using docker gitlab
I looked the different posts concerning gitlab, docker, and ssh issues without any help. So, I ask my question here.
I have the following setting:
-
linux box with ubuntu server 14.04 and IP 192.168.1.104
-
DNS: git.mydomain.com = 192.168.1.104
-
A gitlab docker that I start, according to the official doc, this way:
sudo docker run --detach --name gitlab_app --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data gitlab_image
or
sudo docker run --detach --name gitlab_app --publish 8080:80 --publish 2222:22 -e "GITLAB_SHELL_SSH_PORT=2222" --volumes-from gitlab_data gitlab_image
-
the linux box runs an nginx which redirects (proxy_pass) git.mydomain.com to 192.168.1.104:8080
-
I access git.mydomain.com without any issue, everything works.
-
I generated an ssh key that I have added to my profile on gitlab and added the following lines to my ~/.ssh/config
Host git.mydomain.com User git Port 2222 IdentityFile /home/user/.ssh/id_rsa
-
If I try
ssh -p 2222 git@git.mydomain.com
the connection is closed. I assume it is because only a git-shell is permitted.
-
But, if I try
mkdir test cd test git init touch README.md git add README.md git commit -m "first commit" git remote add origin git@git.domain.com:user/test.git git push -u origin master
it stucks with
Connection closed by 192.168.1.104 fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
I also tried with
git remote add origin git@git.domain.com:2222/user/
and the result was the same. Note that the logs of gitlab docker include
[2015-03-06T11:04:43+00:00] INFO: group[git] created
[2015-03-06T11:04:43+00:00] INFO: user[git] created
[2015-03-06T11:04:44+00:00] INFO: group[gitlab-www] created
[2015-03-06T11:04:44+00:00] INFO: user[gitlab-www] created
Any idea how I can fix this issue?
Also, it seems that the "GITLAB_SHELL_SSH_PORT=2222" option used when starting gitlab docker should result in the port appearing in the git urls displayed but gitlab but it's not the case.
Thanks in advance for your help