git-js icon indicating copy to clipboard operation
git-js copied to clipboard

Does it work with SSH Agent?

Open ybushev opened this issue 3 years ago • 2 comments

Hey, I'm trying to clone project from GitHub using ssh agent authentication:

execSync(`ssh-agent -s -a "/tmp/ssh-agent.socket"`, { uid: UID })

export const GitClient = simpleGit({
  baseDir: USER_DIRECTORY,
  spawnOptions: {
    uid: UID
  }
}).env('SSH_AUTH_SOCK', '/tmp/ssh-agent.socket');

But got the error:

message: "Cloning into '/home/user/test_pub_10'...
Warning: Permanently added the RSA host key for IP address '140.82.113.4' to the list of known hosts.
Load key "/home/user/.ssh/id_rsa": invalid format
[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."

When I'm trying to run the git client from a console using the same user it's working great:

[web]$ ssh -T [email protected]
Hi ybushev! You've successfully authenticated, but GitHub does not provide shell access.

What I missed? Thanks!

ybushev avatar Mar 12 '22 03:03 ybushev

by the way .another question. how to do same things on windows

stepjacky avatar Mar 03 '23 00:03 stepjacky

by the way .another question. how to do same things on windows

Better use WSL for your development workflows.

danikane avatar Jun 18 '24 10:06 danikane