【发布时间】:2015-10-26 18:03:42
【问题描述】:
我在脚本中工作以使用脚本推送到 git,所以我选择 Rugged 来执行此操作,当我尝试推送到 repo 时出现问题,它给了我错误,你能帮帮我吗?
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"
我的错误信息是:
/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:inpush' 来自 vips.rb:43:in `'
【问题讨论】:
-
请在您的存储库中运行
git remote show origin并显示输出。 -
这是输出:远程来源获取 URL:git@devserver:nizar/testignore1 推送 URL:git@devserver:nizar/testignore1 头分支:主远程分支:主跟踪
-
这很奇怪。你的操作系统是什么? Ubuntu?
-
不是 Ubuntu,我用的是 OSX
-
你的包管理器是什么,Homebrew?
标签: ruby-on-rails ruby git