使用现有密钥配置Git [英] Configure Git With Existing Keys

查看:460
本文介绍了使用现有密钥配置Git的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用公钥和私钥配置了git。我把我的公钥发给了服务员。
然后我格式化了我的电脑并重新安装了Windows。但在格式化系统之前,我将两个键都保存在了硬盘上。
现在我想使用现有密钥重新配置我的Git。
我该怎么做?

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????

推荐答案

您只需将 C:\ Users \YourAccount \中键入id_rsa id_rsa.pub 键(您先前保存的)。 ssh (如果它不存在,则创建目录' .ssh ')。

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).

该路径是 git-cmd.bat (位于 msysgit )定义在 %HOME%,并且ssh需要在%HOME%/。ssh 中查找您的密钥。

请注意,对于 HOME 来说,重要的是由msysgit会话(a cmd git-bash ) ,因为Windows本身从不定义环境变量 HOME (它使用 USERPROFILE in取而代之,这ssh一无所知)。

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).

这篇关于使用现有密钥配置Git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆