indee423
indee423

Reputation: 461

Gitlab: remote: Your SSH key has expired

I was trying to push changes to the branch but i got this error:

remote: Your SSH key has expired.
remote: 
remote: ========================================================================
remote: 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

i generated new access token in gitlab settings but i'm not sure how can i add to my project so i can push again

Upvotes: 20

Views: 75105

Answers (6)

Roger C S Wernersson
Roger C S Wernersson

Reputation: 6562

Removing the old SSH key is important. I got rid of the error once I deleted the old key.

Upvotes: 1

Adam
Adam

Reputation: 28968

You need to go to Profile->SSH Keys , remove the key that expired and then re-add it.

Although not recommended, you can avoid that a SSH Key expires by removing the expire date on creation. By default, expire date is set to next year. If you click the cancel icon, expiration date is set to never: enter image description here

Upvotes: 14

MakisH
MakisH

Reputation: 1183

In case anyone else lands on this question looking for clues on why their new key does not work after configuring your SSH client to use it:

For me, I had to remove the expired key from GitLab (and potentially your client) to make it proceed with trying the new one.

Upvotes: 4

doctorprofessor
doctorprofessor

Reputation: 425

This is a hack but if you're using that ssh key elsewhere to and don't want to update it everywhere AND you don't have security concerns, you can scroll all the way down on the page where gitlab displays your expired ssh key and hit Remove. Then you can add the same key again and have 1 more year validity on it

Upvotes: 31

akop
akop

Reputation: 7835

The SSH-key is not your access-key.

Go to settings and setup a new SSH-key.

Edit

  1. Click on "Preferences"
    Image for opening settings dialoge
  2. Click on "SSH Keys" (it is under "Access token")
    Image of settings
  3. Just add a key (fill out "Key" and "Title" and press "Add key" button
    SSH Dialog

Upvotes: 17

ehlJay
ehlJay

Reputation: 151

Follow the documentation to generate a new SSH key and remove your old one / add the new one:

https://docs.gitlab.com/ee/user/ssh.html

Upvotes: 7

Related Questions