How to clone a repository with SSH using simple-git?
I'm trying to clone using this code
const git: SimpleGit = simpleGit();
const sshUri = 'git@..........'
const localPath = '/usr/workspace';
git
.clone(
sshUri,
localPath
).then((data) => {
console.log('success');
}).catch((err) => {
console.log(err);
});
But I am getting an exception
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
If your git repo is private, you will need to generate SSH key and add this key to your GIT account.
Code example