Problem with pull and push in Gitlab

We can not pull and push in Gitlab. On cloning using ssh, the git creates a directory, then fails to authenticate the user. It keeps prompting for the password.

Below is the error message:
"Permission denied (publickey,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists."

We tried to recreate the SSH key using the command " sudo -u git -H bundle exec rake gitlab:shell:setup RAILS_ENV=production" which also gives syntax error.

"[!] There was an error parsing Gemfile: compile error - syntax error, unexpected ‘:’, expecting $end
gem “mysql2”, group: :mysql
^. Bundler cannot continue.

from /home/git/gitlab/Gemfile:21

#gem ‘mysql2’

gem “mysql2”, group: :mysql

gem “pg”, group: :postgres

Any suggestion ?

Gitlab uses an alternative location for the authorized_keys file (/var/opt/gitlab/.ssh/authorized_keys), make sure that that is included (at least for the git user) in your sshd config.

Thanks for your suggestion, Bartj.
The Gitlab we are using very old version 7+ and installed through source so the SSH key location is /home/git/.ssh/authorized_keys.

We tried to upgrade Gitlab to the latest version but it was not successful so had to restore Gitlab from the backup, the SSH keys are not working after restored. Any idea?

Unfortunately not, without logging this is hard to debug. If it prompts for a password, it seems to ignore the key.

Thank you. Fixed ssh key error. Now unable to merge projects and below are the error message from the githost.log. Any idea?

-> ERROR -> Command failed [1]: /usr/bin/git --git-dir=/home/git/gitlab-satellites/xxx/xxxx.git --work-tree=/home/git/gitlab-satellites/xxx/xxxx push origin master

remote: /home/git/gitlab/Gemfile:21:in eval_gemfile': (Bundler::Dsl::DSLError) remote: [!] There was an error parsing Gemfile: compile error - syntax error, unexpected ':', expecting $end remote: gem "mysql2", group: :mysql remote: ^. Bundler cannot continue. remote: remote: # from /home/git/gitlab/Gemfile:21 remote: # ------------------------------------------- remote: # #gem 'mysql2' remote: > gem "mysql2", group: :mysql remote: # gem "pg", group: :postgres remote: # ------------------------------------------- remote: from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.16.0.pre.2/lib/bundler/dsl.rb:12:in evaluate’
remote: from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.16.0.pre.2/lib/bundler/definition.rb:36:in build' remote: from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.16.0.pre.2/lib/bundler.rb:135:in definition’
remote: from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.16.0.pre.2/lib/bundler.rb:101:in `setup’
remote: from /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.16.0.pre.2/lib/bundler/setup.rb:20
To /home/git/repositories/xxx/xxxx.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ‘/home/git/repositories/xxx/xxxx.git’

Sorry, no clue here

Finally fixed this problem. Gitlab gems was using the system Ruby (1.8.x). I had to remove it using yum and now working fine.

Do $ rpm -qa | grep -i ruby
It will give you like ruby.1.8…*
DO yum erase ruby-1.8.7.374-5.el6.x86_64