0

I've installed GitLab per https://github.com/gitlabhq/gitlab-recipes/tree/master/install/centos.

The instructions state to add user "git"

adduser --system --shell /sbin/nologin --comment 'GitLab' --create-home --home-dir /home/git/ git

All seemed to work. I then added a project on the GitLab server, and it gave instructions to push to it:

cd existing_git_repo
git remote add origin git@mysite.com:root/bidjunction.git
git push -u origin master

I then went to my client to push to the git server.

[Michael@devserver bidjunction]$ git push -u origin master
The authenticity of host 'mysite.com (123.456.789.01)' can't be established.
RSA key fingerprint is cd:32:3c:5a:4e:33:44:11:df:ee:3s:4b:3a:c2:a4:c2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'mysite.com,123.456.789.01' (RSA) to the list of known hosts.
Address 123.456.789.01 maps to ve6.phpwebhosting.com, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
git@mysite.com's password:

Is there a password I should have set? Probably not, and instructions don't address.

Reading System ask password when push project to github, it appears it might be related to SSH.

GitLab provides the following instructions to add a SSH key. I followed them, and first added the key to my general user's home on the server. No change. Then tried logging on a root, and added a key to git's home. Still none, but I am thinking that the client already has my general user's key, thus is not pulling the new git key.

EDIT. Please confirm that I should add these keys to the GitLab server, and not my Linux client.

Any and all help would be very much appreciated.

SSH Keys

SSH key allows you to establish a secure connection between your computer and GitLab

Before generating an SSH key, check if your system already has one by running cat ~/.ssh/id_rsa.pub If your see a long string starting with ssh-rsa or ssh-dsa, you can skip the ssh-keygen step.

To generate a new SSH key just open your terminal and use code below. The ssh-keygen command prompts you for a location and filename to store the key pair and for a password. When prompted for the location and filename you can press enter to use the default. It is a best practice to use a password for an SSH key but it is not required and you can skip creating a password by pressing enter. Note that the password you choose here can't be altered or retrieved.

ssh-keygen -t rsa -C "$your_email"

Use the code below to show your public key.

cat ~/.ssh/id_rsa.pub

Copy-paste the key to the 'My SSH Keys' section under the 'SSH' tab in your user profile. Please copy the complete key starting with ssh- and ending with your username and host.

EDIT 2

Looks like I was confused, and used GitLab's server id_rsa.pub. Guess that doesn't make any sense! I've since corrected it, but now I get this error:

[Michael@devserver ~]$ ssh git@mysite.com
Address 123.456.789.01 maps to ve6.phpwebhosting.com, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
PTY allocation request failed on channel 0
This account is currently not available.
                                        Connection to mysite.com closed.
[Michael@devserver ~]$
0

3 Answers 3

1

Seems like a SELinux permission issue. Steps to follow:

  1. restorecon -R -v /home/git/.ssh
  2. usermod -s /bin/bash git
  3. Edit your home machine user's .ssh/config to something like:
Host mysite.com
  User gitlab_username
  Hostname mysite.com
  PreferredAuthentications publickey
  IdentityFile /home/user/.ssh/id_rsa

Try connecting to the gitlab server ssh -T git@mysite.com. You should see a message welcoming you.

I added it to the installation guide. I have a merge request ready with several enhancements. I will merge it when gitlab 6.8 is released.

5
  • Thanks axil. Currently, I have SELinux in permissive mode. Please see my EDIT 2 on my original post. Thoughts? I made the changes to .ssh/config as suggested. Do this to the client, not the GitLab server, correct? Got error Bad owner or permissions on /home/Michael/.ssh/config. Which user should I be using? Git? My client user? Thank you! Apr 22, 2014 at 15:35
  • That's correct. You should be using the user with which you sign in to gitlab. There is an updated guide for CentOS btw :)
    – axil
    Apr 22, 2014 at 16:55
  • Thanks Axil, I will start over following the updated guide, and see what happens. How far back do you think I need to go (i.e. should I yum remove anything)? Also, I have been configuring Apache differently than recommended by the guide. Please see stackoverflow.com/questions/23227851/…. Thank you Apr 22, 2014 at 18:53
  • I don't think you would need to uninstall anything.
    – axil
    Apr 22, 2014 at 19:24
  • Thanks again Axil, Did you have a chance to look at stackoverflow.com/questions/23227851/…? Apr 22, 2014 at 23:44
0

I believe you need to set up your global config username and email

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
0
-1

Check if the git user has a no login shell as you specified. Changing that to bash as suggested fixed my problem (usermod -s /bin/bash git).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.