![](/img/trans.png)
[英]Find all repo branches with the ruby-git gem, without cloning the whole repo
[英]cloning private repo using ruby-git
我正在使用ruby-git以編程方式執行托管在GitHub上的git repos的一些操作。
當我在公共倉庫上執行所有操作時一切正常,但是,即使我在代碼運行時在計算機上創建了一個ssh密鑰並將其添加到GitHub上,也無法克隆私有倉庫。 為了確保正確設置密鑰,我直接從終端克隆了存儲庫,並且存儲庫已成功克隆。 該密鑰也已添加到ssh-agent中,並設置了$SSH_AUTH_SOCK
。 因此,我認為問題與我如何使用ruby-git gem有關。
這是我的(簡單)代碼
@repo = Git.clone("git@github.com:#{repo_full_name}.git", path)
在這里,如果有幫助的話
Git::GitExecuteError: git clone '--' 'git@github.com:USER/REPO.git' '/var/www/repo-root/USER/REPO' 2>&1:Cloning into '/var/www/repo-root/USER/REPO'... Permission denied (publickey). fatal: Could not read
我在這里想念什么嗎?
謝謝
您的Git env配置是否指向ssh密鑰路徑?
Git.configure do |config|
# If you want to use a custom git binary
config.binary_path = '/git/bin/path'
# If you need to use a custom SSH script
config.git_ssh = '/path/to/ssh/script'
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.