Kex
Kex

Reputation: 8579

How do I use my SSH keys for Git on another remote server?

I am having issues getting Git to work on a newly setup remote server. The actual server itself I have turned off password authentication and am using key authentication. They key the server uses is the same key I use for git.

I added the key to the server using ssh-copy-id [email protected] from my local machine, and then sudo chmod -R 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys on the remote machine.

Now to git. I am trying to run git clone [email protected]:user/some-repo.git from the remote server and get the following log:

Warning: Permanently added the RSA host key for IP address 'xx.xxx.xx.xx' to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

How do I get this to work? Does the private key also need to be copied onto this machine? How do I go about doing this?

Any pointers would be greatly appreciated. Thanks!

Upvotes: 0

Views: 1048

Answers (1)

Daniil Pavenko
Daniil Pavenko

Reputation: 54

For your case, will be correct to generate a new ssh key, use ssh-keygen flow, and add into your Git account as a new access key.

Upvotes: 1

Related Questions