Skip to content

Instantly share code, notes, and snippets.

@coffeencoke
Last active December 18, 2015 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coffeencoke/5769904 to your computer and use it in GitHub Desktop.
Save coffeencoke/5769904 to your computer and use it in GitHub Desktop.
Fetch all repositories in my Projects directory
require 'grit'
Grit.debug = true # to show when remotes could not be fetched in STDOUT
files = Dir.glob(File.join("**", ".git"))
files.each do |f|
dir = File.expand_path "../", f
puts "Fetching #{dir}"
r = Grit::Repo.new dir
r.remote_fetch 'origin', timeout: false # Use https://github.com/coffeencoke/grit/tree/pass_options_to_fetch
end
@coffeencoke
Copy link
Author

if you have to fetch a lot of data, for one repo, this script may time out. In which case, you should manually fetch that repo and then rerun the script.

I have not figured out how to configure the time out with grit

@coffeencoke
Copy link
Author

Modified Grit to allow modifying the timeout of fetch in my fork: coffeencoke/grit@pass_options_to_fetch branch, there is also a pull request for this here: mojombo/grit#168

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment