简体   繁体   English

如何使用Rugged ruby​​ gem拉出git存储库

[英]How to pull git repository using Rugged ruby gem

How do I pull changes from remote repo using Rugged ruby gem. 如何使用Rugged ruby​​ gem从远程仓库中提取更改。 Most of question on this topic are outdated as api has changed. 随着api的改变,关于这个主题的大多数问题已经过时了。 I am using a simple repo with nothing complex. 我正在使用一个简单的回购,没有任何复杂的。 I found below code on one of the stackoverflow question but unfortunately its outdated 我在下面的一个stackoverflow问题上找到了代码,但不幸的是它过时了

remote = repo.remotes['origin']
remote.fetch(credentials: credentials)
remote.save

Also remote.fetch gives {:total_objects=>0, :indexed_objects=>0, :received_objects=>0, :local_objects=>0, :total_deltas=>0, :indexed_deltas=>0, :received_bytes=>0} and no changes are pulled remote.fetch{:total_objects=>0, :indexed_objects=>0, :received_objects=>0, :local_objects=>0, :total_deltas=>0, :indexed_deltas=>0, :received_bytes=>0}并且没有改变了

The docs have this example: 文档有这个例子:

remote = Rugged::Remote.lookup(@repo, 'origin')
remote.fetch({
  transfer_progress: lambda { |total_objects, indexed_objects, received_objects, local_objects, total_deltas, indexed_deltas, received_bytes|
    # ...
  }
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM