Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab 500 error when adding/removing SSH key

When I try to add a SSH key to Gitlab 7.3.1 on Ubuntu 14.04 it doesn't work. I get an 500 internal server error and the site is extremly slow.

On refresh nothing is added and when I try again, same problem over and over again.

Trying to read the logs:

# tail -f /var/log/gitlab/gitlab-rails/production.log

Parameters: {“utf8″=>”✓”, “authenticity_token”=>”nKCheVvcyuhTrKUTrWbin9VOYpVPJEWk6lAJO63Lu9o=”, “key”=>……………………………….

…………………………………………….

………………………………………………………………….”}} Completed 500 Internal Server Error in 137ms

Errno::ENOMEM (Cannot allocate memory – ssh-keygen): lib/gitlab/popen.rb:23:in popen’ app/models/key.rb:78:inblock in generate_fingerpint’ app/models/key.rb:75:in generate_fingerpint’ app/controllers/profiles/keys_controller.rb:20:increate’

How to fix this?

like image 215
Chilion Avatar asked Nov 06 '14 10:11

Chilion


People also ask

Can I have 2 SSH keys GitLab?

Gitlab won't allow reuse of a public ssh key for multiple accounts. To get around this you need to create a second ssh key for the second account.

What is add SSH key in GitLab?

The SSH stands for Secure Shell or Secure Socket Shell used for managing the networks, operating systems and configurations and also authenticates to the GitLab server without using username and password each time. You can set the SSH keys to provide a reliable connection between the computer and GitLab.

What type of SSH key should I use for GitLab?

It is generally recommended you use ED25519 SSH keys, which are more secure, and should be available on any system.

Where are GitLab SSH keys stored?

By default, all GitLab SSH keys must go in an . ssh folder under the user's home directory.


1 Answers

Probably because Gitlab can't allocate enough memory,

You need to create a swap file. Try the following steps to see if this works:

#dd if=/dev/zero of=/swapfile bs=2048k count=1000
#mkswap /swapfile
#swapon /swapfile
#swapon -s
#chown root:root /swapfile
#chmod 0600 /swapfile
#echo 10 | sudo tee /proc/sys/vm/swappiness
#echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf

If this works you can make it permanent by editing the following file: #nano /etc/fstab

add this line :

/swapfile       none    swap    sw      0       0

Hope this helps

like image 175
Chilion Avatar answered Nov 08 '22 16:11

Chilion