Merge pull request #361 from mdelagralfo/git-credential-fix

fixing git credential helper for GitHub Enterprise
This commit is contained in:
Adam Ochonicki 2013-11-02 10:28:28 -07:00
commit e17ecb112f

View file

@ -25,8 +25,11 @@ require "boxen/config"
config = Boxen::Config.load config = Boxen::Config.load
input = $stdin.read input = $stdin.read
attrs = Hash[input.split($/).map { |l| l.split("=") }] attrs = Hash[input.split($/).map { |l| l.split("=") }]
# find GitHub or GitHub Enterprise host
ghhost = URI(config.ghurl).host
if command == "get" && attrs["host"] =~ /(^|\.)github\.com$/ host_exp = Regexp.new "(^|\.)" + Regexp.escape(ghhost)
if command == "get" && host_exp.match(attrs["host"])
puts "username=#{config.token}" puts "username=#{config.token}"
puts "password=x-oauth-basic" puts "password=x-oauth-basic"
else else