Is it Possible to transfer the Git SSHKey from one system to another
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.
- Multiple github accounts: what values for Host in .ssh/config?
- GitHub Error: Key already in use
- Git authentication fails during Bower install only (exit code #128)
- Working on two different Git Organization repos using two different credentials in proxy mode
- Git can't connect to Gitlab, SSH verification error
- Adding SSH-key through curl: Fingerprint cannot be generated
Is it possible to use the same key?
I tried the below steps: (Once git got installed in Fedora.)
ssh-keygen -t rsa -C "email@example.com"(same email id used as on Windows OS)
- 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)
git clone firstname.lastname@example.org:x2.git
But no luck.
When i try:
git clone email@example.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.
3 Solutions collect form web for “Is it Possible to transfer the Git SSHKey from one system to another”
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.
As mentioned @manojlds, you can copy ssh keys. I have personally done that across development machines.
The connection time seems to be due to the ssh-daemon not running. To ensure you can connect to the machine please run the following diagnostics
ps -ef | grep sshd
You should get
root 726 1 0 08:07 ? 00:00:00 /usr/sbin/sshd -D
If sshd is running, double check the permissions on your keys and forcibly set to 0700.
cd .ssh chmod -R 0700 * #Read only to the user only
ssh -v <user>@<host>, if you get
ssh -v 192.168.0.150 OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to 192.168.0.150 [192.168.0.150] port 22. debug1: connect to address 192.168.0.150 port 22: Connection refused ssh: connect to host 192.168.0.150 port 22: Connection refused
then there is an issue with your sshdaemon, because the initial handshake has failed. A successful communication looks like:
OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to 192.168.0.xxx [192.168.0.xxx] port 22. debug1: Connection established. debug1: identity file /home/xxx/.ssh/id_rsa type 1 debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048 debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048 debug1: identity file /home/xxx/.ssh/id_rsa-cert type -1 debug1: identity file /home/xxx/.ssh/id_dsa type -1 debug1: identity file /home/xxx/.ssh/id_dsa-cert type -1 debug1: identity file /home/xxx/.ssh/id_ecdsa type -1 debug1: identity file /home/xxx/.ssh/id_ecdsa-cert type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.6 debug1: match: OpenSSH_5.6 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.8p1 Debian-1ubuntu3 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Server host key: RSA zz The authenticity of host '192.168.0.xxx (192.168.0.xxx)' can't be established. RSA key fingerprint is zzzzz. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.0.xxx' (RSA) to the list of known hosts. debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,keyboard-interactive debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/parj/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 279 debug1: Authentication succeeded (publickey). Authenticated to 192.168.0.xxx ([192.168.0.xxx]:22). debug1: channel 0: new [client-session] debug1: Requesting firstname.lastname@example.org debug1: Entering interactive session. debug1: Sending environment. debug1: Sending env LANG = en_GB.UTF-8 Last login: Wed Dec 21 16:46:48 2011
LocalUser is Lu , and RemoteUser is Ru.
Lu$ mkdir ~/.ssh
Lu$ scp usernameOfRu@ipOfRu:.ssh/* .ssh/*
usernameOfRu@ipOfRu’s password: “Enter password of remote system”