Git push / pull not working on GitLab in Google Compute Engine

I installed GitLab on the Google Compute Engine using "Click to Deploy" from the project interface. After a few minutes, the deployment will succeed. I can include SSH in the instance and drop it as expected.

I can also log into GitLab using the web interface and add SSH keys to my profile. So far, so good. However, when I try to click or pull examples into the new repository, I get this message:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 

I deleted my local SSH configuration so that it does not interfere. Do I need to configure an SSH tunnel? What am I missing?

UPDATE: Clean out my local ~ / .ssh folder and restore the SSH key (which I added to my profile in GitLab) causes the following error:

 Received disconnect from {GITLAB_IP_ADDRESS}: 2: Too many authentication failures for git fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 

UPDATE 2: It seems that GitLab already has a solution: run sudo gitlab-ctl reconfigure . See here: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#git-ssh-access-stops-working-on-selinux-enabled-systems

+4
source share
3 answers

You need to create an SSH tunnel to communicate with GitLab.

1. Log in to your development server as your user and create a key.

 ssh-keygen -t rsa 

Follow the steps and create the passcode (which you can remember) as you need to pull and push the code from / to GitLab.

2. Now that you have created your key, we can copy it,

 cat id_rsa.pub 

Copy the output of this command (including ssh-rsa ) and add it to your GitLab profile. ( http://my-gitlab-server.com/profile/keys/new ).

3. Verify that you have the correct privilege for the project (s)

Make sure you are at least a role developer. (Screengrab roles: http://i.stack.imgur.com/DSSvl.jpg )

4. Now copy the project link

Enter your project and find the SSH link in the upper right corner;

enter image description here

5. Now back to your development server

Go to your directory where you want to work, and do the following:

 $ git init $ git remote add origin <<project_url>> $ git fetch 

Where <<project_url>> is the link we copied in step 4.

You will be asked to enter a password (this is your ssh password, not your server password) and add the host to your known_hosts file. After that, the project will start loading, and you can enjoy the development.

I did these steps on a CentOS 6.4 machine with Digital Ocean. But they should not be different from using Google CE.

Edit

Quote from Marty Penner reply this comment

I decided! Thanks to @sxleixer and @Alexander Wenzowski for this.

Apparently SELinux intervened in a non-standard location for the .ssh directory. I needed to run the following compute engine instance commands:

 sudo yum -y install policycoreutils-python # Install the `semanage` tool sudo semanage fcontext -a -t ssh_home_t "/var/opt/gitlab/.ssh/authorized_keys" # Allow the nonstandard ssh_home_t 

See the full version here:

Google Cloud Engine Permission denied (publickey, gssapi-keyex, gssapi-with-mic)

+6
source

I decided! Thanks to @sxleixer and @ Alexander Wentsovsky for understanding this.

Apparently SELinux intervened in a non-standard location for the .ssh directory. I needed to run the following compute engine instance commands:

 sudo yum -y install policycoreutils-python # Install the `semanage` tool sudo semanage fcontext -a -t ssh_home_t "/var/opt/gitlab/.ssh/authorized_keys" # Allow the nonstandard ssh_home_t 

See the full version here:

Google Cloud Engine Permission denied (publickey, gssapi-keyex, gssapi-with-mic)

UPDATE: It seems that GitLab already has a solution: run sudo gitlab-ctl reconfigure . See here: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#git-ssh-access-stops-working-on-selinux-enabled-systems

+3
source

In my situation, the git user was not fully configured. If you log into your log files, such as "The git user is not allowed because the account is locked" (in the Centos or Redhat it / s / var / log / secure section), you just need to activate the user through "passwd -d git "

0
source

Source: https://habr.com/ru/post/1245537/


All Articles