简体   繁体   中英

How to pull git repository using Rugged ruby gem

How do I pull changes from remote repo using Rugged ruby gem. Most of question on this topic are outdated as api has changed. I am using a simple repo with nothing complex. I found below code on one of the stackoverflow question but unfortunately its outdated

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

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|
    # ...
  }
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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