git密匙有什么用,使用现有密钥配置Git

素颜马尾好姑娘i 2023-01-24 02:27 226阅读 0赞

![Image 1][]

I have configured git with public and private key. I sent my public key to server guy.

Then I formatted my PC and installed windows again. But I saved my both keys on the hard drive before formatting system.

Now I want to reconfigure my Git using existing keys.

How can I do this????

解决方案

You simply need to copy your id_rsa and id_rsa.pub keys (that you previously saved) in C:\Users\YourAccount\.ssh (create the directory ‘.ssh’ if it doesn’t exist).

That path is what git-cmd.bat (in msysgit) defines at %HOME%, and ssh needs to look for your keys in %HOME%/.ssh.

Note that it is important for HOME to be defined by a msysgit session (a cmd or a git-bash), because Windows itself never defines the environment variable HOME (it uses USERPROFILE instead, which ssh known nothing about).

[Image 1]:

发表评论

表情:
评论列表 (有 0 条评论,226人围观)

还没有评论,来说两句吧...

相关阅读

    相关 如何创建git

    最近公司给新配了一台电脑,涉及到重新搭建项目环境和配置以及从SVN改成Git来管理代码,过程中涉及到Git密钥的创建,具体操作步骤如下: 1. 下载Git到本地。 2. 找