mardi 4 août 2015

Push to Git using Rugged

I worked in a script to push to git using a script, so I choose Rugged to do that, my probleme when I try to push to repo, it gives me error, Can you help me ?

require 'rugged'


git_email = 'ettaheri.nizar@gmail.com'
git_name = 'Nizar'
repo_name = '/Users/euphor/Desktop/test/testignore1'


repo = Rugged::Repository.new('/Users/euphor/Desktop/test/testignore1')
puts "1"
index = repo.index
puts "3"

oid = repo.write("This is a blob.", :blob)

index.add(:path => "testignore1", :oid => oid, :mode => 0100644)
puts "4"

options = {}
options[:tree] = index.write_tree(repo)
puts "5"
options[:author] = { :email => git_email, :name => git_name, :time => Time.now }
options[:committer] = { :email => git_email, :name => 'Test Author', :time => Time.now }
puts "6"
options[:message] ||= "Making a commit via Rugged!"
options[:parents] = repo.empty? ? [] : [ repo.head.target ].compact
options[:update_ref] = 'HEAD'
puts "7"
Rugged::Commit.create(repo, options)
puts "8"
**repo.push 'origin'**  # this is my error
puts "Done"

the message of my error is :

/Library/Ruby/Gems/2.0.0/gems/rugged-0.23.0/lib/rugged/repository.rb:224:in push': Unsupported URL protocol (Rugged::NetworkError) from /Library/Ruby/Gems/2.0.0/gems/rugged-0.23.0/lib/rugged/repository.rb:224:in push' from vips.rb:43:in `'



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire