diff --git a/script/boxen-git-credential b/script/boxen-git-credential index fbecc88..8ce8d80 100755 --- a/script/boxen-git-credential +++ b/script/boxen-git-credential @@ -25,8 +25,11 @@ require "boxen/config" config = Boxen::Config.load input = $stdin.read 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 "password=x-oauth-basic" else