Tag: 坚固耐用

无法使用Rugged克隆存储库

使用带有已安装依赖项的openSUSE和Ubuntu我无法使用Rugged::Repository.clone_at方法克隆远程存储Rugged::Repository.clone_at并收到错误消息: Rugged :: NetworkError:未实现此传输。 抱歉 代码: credentials = Rugged::Credentials::SshKey.new(:privatekey=>’path/to/privatekey’, :publickey=>’path/to/publickey’, :passphrase=>’passphrase’) Rugged::Repository.clone_at ‘ssh://github.com/vmoravec/repo’, ‘dir/to/destination’, :credentials => credentials 我的用于rails项目的Gemfile包含对github repo的引用,如下所示: gem ‘rugged’, git: ‘git://github.com/libgit2/rugged.git’, branch: ‘development’, submodules: true gem已经安装了命令bundle install –path bundle/即使使用bundle exec rails console ,克隆也不起作用 已安装的系统包: libssh2,libssh2-devel openssl,libopenssl-devel,libopenssl 在SO上已经有类似的问题,但解决方案不起作用(虽然我觉得它适用于MacOS): 在#connect上获取Rugged :: NetworkError

使用Rugged / libgit2创建提交时如何更新工作目录?

我正在尝试使用以下测试脚本创建一个坚固的提交: require “rugged” r = Rugged::Repository.new(“.”) index = r.index index.read_tree(r.references[“refs/heads/master”].target.tree) blob = r.write(“My test”, :blob) index.add(:oid => blob, :path => “test.md”, :mode => 0100644) tree = index.write_tree parents = [r.references[“refs/heads/master”].target].compact actor = {:name => “Actor”, :email => “actor@bla”} options = { :tree => tree, :parents => parents, :committer => actor, :message => “message”, :update_ref => […]

我如何使用rugged来创建和提交命令行中的文件?

我正在尝试使用坚固的做一些非常简单的事情:创建并提交一个文件,使存储库处于与执行相同的状态: git init echo “blah blah blah” > blah.txt git add blah.txt git commit -m “write blah.txt” 留下git status打印 On branch master nothing to commit, working directory clean 我使用的代码改编自坚固的回购自述文件 ,归结为: name = “blah.txt” repo = Rugged::Repository.init_at dir File.open File.join(dir, name), ‘w’ do |f| f.write content end oid = Rugged::Blob.from_workdir repo, name index = repo.index index.add(:path […]