简体   繁体   中英

Different SSH locations for git?

I recently reinstalled Windows on my PC. However the new SSH location on my PC is different because the username is different. When I try to sync git, it still looks for the previous ssh location.

My question is simply why is it looking for the previous location?

EDIT

I forgot to mention that I copied all my repositories and .ssh folder over.

Git will always look by default for ssh keys in %USERPROFILE%\\.ssh\\id_rsa(.pub) .

Warning, with Git 2.19+ , you need to add the -m PEM option to ssh-keygen:

ssh-keygen -t rsa -m PEM -P ""

The only way Git would look elsewhere is if you have restored your %USERPROFILE%\\.ssh\\config file, in which you could have set a specific path for a private key.

all it's looking for is the private key. since you reinstalled Windows, you would have lost you previous key. only option you have is to generate a new key and configure it's corresponding public key on git again.

PS: you are incorrect in assuming that it's due to change in location or that git's even looking for your key at a certain location.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM