cloning private repo using ruby-git

I’m using ruby-git to programmatically perform some operations git repos hosted on GitHub.

Everything works fine when I do it on public repos however, I’m not able to clone private repos even if I have created an ssh key on the machine when the code runs and added the public one on GitHub. To make sure the key is properly setup I have cloned the repo directly from the terminal and the repo was successfully cloned. The key has also been added to the ssh-agent and $SSH_AUTH_SOCK is set.
So, I think the issue is related to how I use the ruby-git gem.

Here my (simple) code

@repo = Git.clone("{repo_full_name}.git", path)

And here, if it may be helpful teh error

 Git::GitExecuteError: git clone '--' '' '/var/www/repo-root/USER/REPO' 2>&1:Cloning into '/var/www/repo-root/USER/REPO'... Permission denied (publickey). fatal: Could not read

Am I missing anything here?


Source: ruby

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.