Home > Enterprise >  How to replace SSH key in local Git Bash
How to replace SSH key in local Git Bash

Time:04-12

I have 2 laptops. On first one I've created a SSH key in GitBash (locally) and successfully added the key on Github, and established the connection. Now I need to get this SSH key from Github and insert it locally on second laptop into GitBash. How can I do it?

Locally in folder ".ssh" I have 2 files: those 2 files But the coding up there does not seems to be similar to what I have on Github.

CodePudding user response:

That's not how you usually do it. The normal workflow is to create a separate key for every machine/user and add it separately.

In github you only place the public key (usually there is some comment after identifying the key) - but for login you need the private part, which is not on github.

The folder you show a screenshot is the one containing the key. So in principle this is the one you would need to copy. But (at least on linux) ssh is very picky about the access right on its files (must be unreadable to anyone but the user) - in short it's a pain to get right, easier to just create a new key.

Another potential issue is git bash - many apps bundle their own variant, so it might well be that the actual key files are in some unexpected location.

and consider what @phd pointed out.

btw if ssh doesn't work github also works over https.

CodePudding user response:

well, i do this on linux, but it works, i simply copy the two files in the new machine, then add it to the ssh-agent there, just like i did in the frist, as long both don't attempt to connect at the same time, no problem.

In case of any access right prblem, I just change it with chmod, but again, thats on linux...

  • Related