是否可以将Git SSHKey从一个系统转移到另一个系统 [英] Is it Possible to transfer the Git SSHKey from one system to another

查看:312
本文介绍了是否可以将Git SSHKey从一个系统转移到另一个系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Git很陌生。
我的客户请求我在我的系统中安装git并告诉我要通过ssh密钥(id_rsa.pub)。我转移了密钥并注册了,之后我们才能下载应用程序。



然后我们决定转到Fedora 14(Linux)。我们再次安装了git,然后我们再次将密钥传输到服务器中注册到客户端。但现在客户提到我们可以使用相同的密钥。



是否可以使用相同的密钥?



我尝试了以下步骤:(一旦git安装在Fedora中)。


  1. ssh-keygen -t rsa -Cyour_email@youremail.com(与在Windows操作系统上使用的电子邮件ID相同)

  2. 用3个文件(id_rsa,id_rsa.pub和known_hosts)的副本创建的所有3个文件都被替换掉了

  3. 尝试了 git clone git @ git .xyz.com:x2.git

但没有运气。



当我尝试时:

  git clone git@git.xyz .com:x2.git 
克隆到x2 ...
ssh:连接到主机git.xyz.com端口22:连接超时
致命:远程端意外挂断。

有人可以帮助我理解和解决这个问题吗?
是否有其他问题锁定访问?



在此先感谢。

解决方案

ssh私钥与机器无关,您可以将其从一台机器复制到另一台机器,并且应该可以ssh(并因此使用git)到有公钥的服务器上。您不必重新创建密钥并替换副本等,但即使您所做的事情从密钥的角度来看也没有问题。



您遇到的错误是 ssh:连接到主机git.xyz.com端口22:连接超时致命这似乎表明该框无法访问服务器。


I am very New to Git. My client asket me to install git in my system and told me to pass the ssh key (id_rsa.pub ).I transfered the key and he registered, after that we were able to download the app.

Then we decided to move to Fedora 14 (Linux). We installed git again and we transferred the key again for registration in server to the client. But now the client mentioned we can use the same key.

Is it possible to use the same key?

I tried the below steps: (Once git got installed in Fedora.)

  1. ssh-keygen -t rsa -C "your_email@youremail.com" (same email id used as on Windows OS)
  2. Replaced all the 3 files created with the copy of the 3 files (id_rsa, id_rsa.pub and known_hosts from Windows install earlier)
  3. Tried git clone git@git.xyz.com:x2.git

But no luck.

When i try:

git clone git@git.xyz.com:x2.git
Cloning into x2...
ssh: connect to host git.xyz.com port 22: connection timed out
fatal: The remote end hung up unexpectedly.

Can somebody help me in understanding and resolving this issue? Is there some other problem locking access?

Thanks in advance.

解决方案

The ssh private key is not tied to a machine and you can just copy it from one machine to another and should be able to ssh ( and hence use git) to the server that has your public key. You do not have to recreate the keys and replace with the copies etc, but even what you have done is fine from the keys point of view.

The error you are getting is ssh: connect to host git.xyz.com port 22: connection timed out fatal which seems to suggest that the box doesn't have access to the server.

这篇关于是否可以将Git SSHKey从一个系统转移到另一个系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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