Id_rsa.pub key access is only temporary

I’ve created a key pair using ssh-keygen then I’ve uploaded it to the SSH Keys section of gitlab.

After a few minutes I’m able to download the repository, modify it, push changes as it should work.

However, I come back the next day and the single sign-on access using ssh no longer works. At one point yesterday I deleted the key from the SSH keys section of gitlab and repasted the exact same key. A few minutes later it worked again. However, again I came in the next day and it doesn’t work again. Here is what I see when I try to get verbose output from ssh:

ssh -v git@gitlab.com
OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to gitlab.com [52.167.219.168] port 22.
debug1: Connection established.
debug1: identity file /home/astone/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/astone/.ssh/id_rsa-cert type -1
debug1: identity file /home/astone/.ssh/id_dsa type 2
debug1: key_load_public: No such file or directory
debug1: identity file /home/astone/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/astone/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/astone/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/astone/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/astone/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
ssh_exchange_identification: read: Connection reset by peer

Any ideas on how to fix this?

Hi,

I think it could be this:

Your authorised_keys file may be out of sync. Check this resolution on the wiki, scroll down until you see the header -

Hope this helps, let me know!

The solution on this site is to execute:
sudo -u git -H bundle exec rake gitlab:shell:setup RAILS_ENV=production

First it gave me an error saying that git is an unknown user so I replaced the call with the user name I’m building the code under.

Then It gave me an error saying bundle is not a known program.
So I installed ruby-bundler package.

Then Executed the command again and now get an error:
Could not locate Gemfile or .bundle/ directory

I’m not sure what this Gemfile or the .bundle directory is used for or how to set this up.