Skip to content
Advertisement

Password for GitLab

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 ~]$

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement