进入安装目录 /opt/gitorious-3.2.0-1/apps/gitorious/htdocs/bin 复制一份 create-user 脚本并命名为 reset-password
cd /opt/gitorious-3.2.0-1/apps/gitorious/htdocs/bin
cp create-user reset-password
#!/opt/gitorious-3.2.0-1/ruby/bin/ruby
require(File.expand_path(File.dirname(__FILE__) + "/setup"))
def yes_no(str)
str == "y"
end
Gitorious::CLI.new.run_with_gitorious_environment do
require "./config/environment"
require "highline/import"
ActionMailer::Base.raise_delivery_errors = false
ActionMailer::Base.delivery_method = :test
if ARGV.empty?
login = ask("Enter login name: ")
password = ask("Enter password: ") { |q| q.echo = "*" }
else
login, password = ARGV
end
user = User.find_by_login(login)
user.password = password
user.password_confirmation = password
user.save()
end
保存后,使用方法:
./reset-password username passwd
或不带参数执行
./reset-password
=>Enter login name: username
=>Enter password: ******
=>