Created
December 7, 2010 05:24
-
-
Save cookbooks/731502 to your computer and use it in GitHub Desktop.
Grit clone example
This file contains hidden or 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
# Since Git is well structured, Grit uses a method missing (Grit::Git#method_missing) to 'systematically' execute Git commands: | |
require 'grit' | |
include Grit | |
gritty = Grit::Git.new('/tmp/filling-in') | |
gritty.clone({:quiet => false, :verbose => true, :progress => true, :branch => '37s'}, "git://github.com/cookbooks/cc-aws.git", "/tmp/cc-aws2") | |
# => "Initialized empty Git repository in /tmp/cc-aws2/.git/\n" | |
Dir.entries('/tmp/cc-aws2').size | |
# => 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe that this is simply a "magic" interface to standard git commands, so:
equates to the
git
command line:So, if your git user is authenticated to clone from that repo, then you should be able to with the Ruby snippet just as if you were running the command line.