DEV Community

Cover image for Managing SSH keys!!
shamnad-sherief
shamnad-sherief

Posted on

2

Managing SSH keys!!

It was all sudden. I configured my ssh key and it shows you are not authorised to make any changes!!??

So what it is? Why this happens??

While trying to figure it out I understood that the ssh agent is confused with the identity file. You can see the permission is denied from the public key. The problem is caused after I added my Gitlab ssh key. Assuming the ssh-agent is confused with my Gitlab and Github ssh keys. When I try to push something, ssh checks for my identity file and it doesn’t know which file to pick!! So it might picked Github ssh key for Gitlab server which caused the error.

Solution

The problem was identifying the identity file. So I made a config file in .ssh folder for a better understanding.

vi ~/.ssh/config

Host gitlab.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/gitlab_key_location
Host github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/github_key_location
Enter fullscreen mode Exit fullscreen mode

Now the ssh agent knows where to look for the private key for each hosts.

Image of Docusign

πŸ› οΈ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay