Reputation: 461
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
Reputation: 6562
Removing the old SSH key is important. I got rid of the error once I deleted the old key.
Upvotes: 1
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:
Upvotes: 14
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
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
Reputation: 7835
The SSH-key is not your access-key.
Go to settings and setup a new SSH-key.
Upvotes: 17
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