1

I've created an SSH key (on PC A) to access my GitHub repo (works correctly). Then I copied this key to PC B. For some reason, I can't access the repo from the PC B even if the public and private keys are the same.

Cloning into 'repo'...
sign_and_send_pubkey: signing failed for RSA "/home/milano/.ssh/github-futilestudio" from agent: agent refused operation
sign_and_send_pubkey: signing failed for RSA "milano@milano-lenovo" from agent: agent refused operation
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What's the reason behind that?

EDIT

Could the reason be the signature at the end of the SSH key?

milano@milano-lenovo

which is obviously a name of the PC A.

2
  • 1
    to debug ssh issues : run ssh -v [user]@[target host] (for example : ssh -v [email protected])
    – LeGEC
    Jun 12, 2021 at 19:48
  • 1
    The key to this error is the text agent refused operation. There are multiple possible reasons for this; see stackoverflow.com/q/44250002/1256452 for details. Note that, as VonC suggests, using a separate key is often a better idea anyway. You should consider your actual situation and the security implications of separate or shared keys.
    – torek
    Jun 13, 2021 at 5:46

1 Answer 1

2

Could the reason be the signature at the end of the SSH key?

No, that part is ignored.
Do copy, to be sure, the public key as well as the private one.

Or, ideally, generate a new one dedicated to the second machine (since copying private keys is not the best practice)

  • If a ssh -Tv [email protected] does show you the right private key is considered, check for a difference in environment variable (type set in a CMD). In particular, make sure you don't have GIT_SSH set to Windows 10 openSSH.
    Type where ssh to make sure Git is using the same openSSH on both machines.

  • If a ssh -Tv [email protected] does show you the right private key is not considered, check if on your first machine you have a %USERPROFILE%\.ssh\config, which should then be replicated on the second one.

Not the answer you're looking for? Browse other questions tagged or ask your own question.