Last active
December 18, 2015 10:39
-
-
Save coffeencoke/5769904 to your computer and use it in GitHub Desktop.
Fetch all repositories in my Projects directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
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