git-shell revision ec61f6f64207b4168960fcd645b1362d86fdecca
2N/A#!/usr/bin/env ruby
2N/A#
2N/A# Git shell, invoked from ~/.ssh/authorized_keys
2N/A#
2N/A
2N/Aunless ENV['SSH_CONNECTION']
2N/A puts "Only ssh allowed"
2N/A exit 1
2N/Aend
2N/A
2N/Arequire File.expand_path('../../lib/init', __FILE__)
2N/Abegin
2N/A require 'git_shell'
2N/A
2N/A key_id = ARGV[0]
2N/A command = ENV['SSH_ORIGINAL_COMMAND']
2N/A
2N/A GitShell.new(key_id, command).exec
2N/Arescue StandardError, ScriptError => error
2N/A Rails.logger.error do
2N/A <<-ERROR
2N/ACould not perform git push for
2N/A Key-Id:<#{key_id}> and command:<#{command}>.
2N/AWe also encountered this error:
2N/A <##{error.class}> <#{error.message}>
2N/AWith this stacktrace:
2N/A #{error.backtrace.join('\n')}
2N/A ERROR
2N/A end
2N/A puts <<-ERROR
2N/AWe encountered a system error while processing your
2N/Agit-interaction attempt.
2N/AThe git command was not processed; your data
2N/Ais safe. Please try again in a few minutes.
2N/AContact an admin if this issue persists.
2N/A ERROR
2N/A exit 1
2N/Aend
2N/A