git clone via ssh not working
Summary
Used versions
- gitlab-ce 11.5.0
- centos 7 -> git --version -> 1.8.3.1
- mac os mojave -> git --version -> 2.17.2 (Apple Git-113)
I've setup gitlab-ce on centos (git already installed on centos machine), created a new project and added my ssh public key inside the user settings profile. When going to settings -> members, my user is tagged as Maintainer. I'm trying to clone the repo with git clone git@my.domain.net:username/my-project.git.
But I get:
Cloning into 'my-project'...
fatal: 'username/my-project.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
When executing: ssh git@my.domain.net, I immediately see something like
Last login: Tue Nov 27 10:45:07 2018 from IPADDRESS
-sh-4.2$
So this seems to work.
When I switch the dropdown to http inside gitlab and enter the suggested git clone command:
git clone http://...
and enter the username and password I've cloned the project successfully. I was also able to create the README.md and push it back.
Environement details: Gitlab is only accessible inside the own vpn/intranet (not a public available domain). I've taken the Omnibus installation but used an external/unbound nginx. Gitlab authentication via LDAP. Don't know if the already installed git somehow interferes into gitlab-ce.
Steps to reproduce
- Create new project
- Select
sshin the dropdown and clone it ->git clone git@my.domain.net:username/my-project.gitYou see the above mentioned error. - Select
httpin the dropdwon and and clone it ->git clone http://...You see it is working without any errors.
What is the current bug behavior?
git clone git@my.domain.net:username/my-project.git via ssh NOT possible, although a) ssh git@my.domain.net works and b) git clone http://... works
What is the expected correct behavior?
git clone git@my.domain.net:username/my-project.git via ssh IS possible
Results of GitLab environment info
Expand for output related to GitLab environment info
sudo gitlab-rake gitlab:env:infoSystem information System: Current User: git Using RVM: no Ruby Version: 2.4.5p335 Gem Version: 2.7.6 Bundler Version:1.16.6 Rake Version: 12.3.1 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.1 Go Version: unknown GitLab information Version: 11.5.0 Revision: b7b1e8e Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: http://my.domain.net HTTP Clone URL: http://my.domain.net/some-group/some-project.git SSH Clone URL: git@my.domain.net:some-group/some-project.git Using LDAP: yes Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 8.4.1 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
sudo gitlab-rake gitlab:check SANITIZE=trueChecking GitLab Shell ... GitLab Shell version >= 8.4.1 ? ... OK (8.4.1) hooks directories in repos are links: ... 2/1 ... ok 2/2 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Gitaly ... default ... OK Checking Gitaly ... Finished Checking Sidekiq ... Running? ... yes Number of Sidekiq processes ... 1 Checking Sidekiq ... Finished Reply by email is disabled in config/gitlab.yml Checking LDAP ... Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) DN: cn=user name,cn=internal,ou=users,dc=domain,dc=com mail: user.name@domain.com Checking LDAP ... Finished Checking GitLab ... Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 2/1 ... yes 2/2 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.4.5) Git version >= 2.9.5 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 2 Checking GitLab ... Finished