简体   繁体   English

如何在Windows 7机器中设置SSH密钥

[英]how to set up ssh key in windows 7 machine

I am learning git. 我正在学习git。

My friend set up a git repo in his server and he give me the link for clone it. 我的朋友在他的服务器上设置了一个git repo,他给了我克隆它的链接。 He also provide me a .ssh folder. 他还为我提供了一个.ssh文件夹。 and i see there is two file id_rsa.pub and id_rsa. 我看到有两个文件id_rsa.pub和id_rsa。

I already install git so I goto to my user folder and see there is also one .ssh folder with that two file. 我已经安装了git,所以转到我的用户文件夹,看到还有一个.ssh文件夹和那两个文件。 Now I just copy and paste my friends key pair but when I trying to clone it it ask me the password. 现在,我只复制并粘贴我的朋友密钥对,但是当我尝试克隆它时,询问我密码。 What wrong I made ? 我做错了什么? what is the right process ? 什么是正确的过程?

The right process would be for you to: 正确的流程适合您:

  • not override your public and private key with the ones from your friend 不要用您朋友的公钥和私钥覆盖
  • not keep the public private key from your friend 不要保留您朋友的公钥
  • give your own public key %HOME%\\.ssh\\id_rsa.pub to your friend for him/her to copy yhat public key in the server ~/.ssh/authorized_keys . 将您自己的公共密钥%HOME%\\.ssh\\id_rsa.pub给您的朋友,以便他/她将yhat公共密钥复制到服务器~/.ssh/authorized_keys

And make sure you start a git session using git-cmd.bat , in order for the environment variable HOME to be properly set (usually to %USERPROFILE% ) 并确保使用git-cmd.bat启动git会话,以便正确设置环境变量HOME (通常设置为%USERPROFILE%

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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