diff --git a/.checkstyle b/.checkstyle
deleted file mode 100644
index 58e2377c2..000000000
--- a/.checkstyle
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/.circleci/config.yml b/.circleci/config.yml
deleted file mode 100644
index ad4036f3c..000000000
--- a/.circleci/config.yml
+++ /dev/null
@@ -1,71 +0,0 @@
-gbsteps: &gbsteps
- steps:
- - run:
- name: Report on build environment
- command: |
- java -version
- javac -version
-
- - checkout
- - run: ant
-
- - run: ant test
- - run:
- name: Collect test results
- command: |
- mkdir -p test_reports/junit/
- cp -a build/tests/TEST-*.xml test_reports/junit/
- - store_test_results:
- path: test_reports
- - store_artifacts:
- path: build/target/reports
-
-
-version: 2.1
-
-
-jobs:
- buildJ8:
- docker:
- - image: circleci/openjdk:8-jdk
-
- <<: *gbsteps
-
- buildJ9:
- docker:
- - image: circleci/openjdk:9-jdk
-
- <<: *gbsteps
-
- buildJ11:
- docker:
- - image: circleci/openjdk:11-jdk
-
- <<: *gbsteps
-
-workflows:
- version: 2
- build:
- jobs:
- - buildJ8:
- post-steps:
- - run:
- name: Upload coverage to Codecov
- command: bash <(curl -s https://codecov.io/bash)
- - run:
- name: Prepare Code Climate coverage reporter
- command: |
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
- - run:
- name: Upload coverage to Code Climate
- command: |
- JACOCO_SOURCE_PATH=src/main/java ./cc-test-reporter format-coverage ./build/target/reports/coverage/jacoco.xml --input-type jacoco
- ./cc-test-reporter upload-coverage
- when: on_success
- - run:
- name: Upload coverage to Codacy
- command: bash <(curl -Ls https://coverage.codacy.com/get.sh) report
- - "buildJ9"
- - "buildJ11"
diff --git a/.classpath b/.classpath
deleted file mode 100644
index ed27f4e0b..000000000
--- a/.classpath
+++ /dev/null
@@ -1,118 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.gitbugtraq b/.gitbugtraq
deleted file mode 100644
index 75e2f96df..000000000
--- a/.gitbugtraq
+++ /dev/null
@@ -1,16 +0,0 @@
-[bugtraq "issues"]
- url = https://github.com/gitblit-org/gitblit/issues/%BUGID%
- loglinkregex = "[Ii]ssue[-#:\\s]{1}\\d+"
- logregex = "\\d+"
- loglinktext = issue-%BUGID%
-[bugtraq "pullrequests"]
- url = "https://github.com/gitblit-org/gitblit/pull/%BUGID%"
- loglinkregex = "(?:pull request|pull|pr)\\s*[-#]?[0-9]+"
- logregex = "\\d+"
- loglinktext = "pull request #%BUGID%"
-[bugtraq "tickets"]
- url = "https://dev.gitblit.com/tickets/gitblit.git/%BUGID%"
- loglinkregex = "(?:ticket)\\s*[-#]?[0-9]+"
- logregex = "\\d+"
- loglinktext = "ticket #%BUGID%"
-
\ No newline at end of file
diff --git a/.github/SECURITY.md b/.github/SECURITY.md
deleted file mode 100644
index 861c96f3d..000000000
--- a/.github/SECURITY.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Security Policy
-
-
-## Reporting a Vulnerability
-
-The Gitblit team takes security bugs seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
-
-
-To report a security vulnerability, you can use the Github mechanism to [privately report a vulnerability](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability). On Gitblit's repository page, choose the `Security` tab (under the repository name). Click the `Report a vulnerability` button on the right.
-
-Alternatively, you can also report any security issue via e-mail. Send an email to the following email address and include the word "SECURITY" in the subject line.
-
-```
-gitblitorg@gmail.com
-```
diff --git a/.github/ok.sh b/.github/ok.sh
deleted file mode 100755
index 6c541c6bb..000000000
--- a/.github/ok.sh
+++ /dev/null
@@ -1,2868 +0,0 @@
-#!/usr/bin/env sh
-# # A GitHub API client library written in POSIX sh
-#
-# https://github.com/whiteinge/ok.sh
-# BSD licensed.
-#
-# ## Requirements
-#
-# * A POSIX environment (tested against Busybox v1.19.4)
-# * curl (tested against 7.32.0)
-#
-# ## Optional requirements
-#
-# * jq (tested against 1.3)
-# If jq is not installed commands will output raw JSON; if jq is installed
-# the output will be formatted and filtered for use with other shell tools.
-#
-# ## Setup
-#
-# Authentication credentials are read from a `$HOME/.netrc` file on UNIX
-# machines or a `_netrc` file in `%HOME%` for UNIX environments under Windows.
-# [Generate the token on GitHub](https://github.com/settings/tokens) under
-# "Account Settings -> Applications".
-# Restrict permissions on that file with `chmod 600 ~/.netrc`!
-#
-# machine api.github.com
-# login
-# password
-#
-# machine uploads.github.com
-# login
-# password
-#
-# Or set an environment `GITHUB_TOKEN=token`
-#
-# ## Configuration
-#
-# The following environment variables may be set to customize ${NAME}.
-#
-# * OK_SH_URL=${OK_SH_URL}
-# Base URL for GitHub or GitHub Enterprise.
-# * OK_SH_ACCEPT=${OK_SH_ACCEPT}
-# The 'Accept' header to send with each request.
-# * OK_SH_JQ_BIN=${OK_SH_JQ_BIN}
-# The name of the jq binary, if installed.
-# * OK_SH_VERBOSE=${OK_SH_VERBOSE}
-# The debug logging verbosity level. Same as the verbose flag.
-# * OK_SH_RATE_LIMIT=${OK_SH_RATE_LIMIT}
-# Output current GitHub rate limit information to stderr.
-# * OK_SH_DESTRUCTIVE=${OK_SH_DESTRUCTIVE}
-# Allow destructive operations without prompting for confirmation.
-# * OK_SH_MARKDOWN=${OK_SH_MARKDOWN}
-# Output some text in Markdown format.
-
-# shellcheck disable=SC2039,SC2220
-
-NAME=$(basename "$0")
-export NAME
-export VERSION='0.7.0'
-
-export OK_SH_URL=${OK_SH_URL:-'https://api.github.com'}
-export OK_SH_ACCEPT=${OK_SH_ACCEPT:-'application/vnd.github.v3+json'}
-export OK_SH_JQ_BIN="${OK_SH_JQ_BIN:-jq}"
-export OK_SH_VERBOSE="${OK_SH_VERBOSE:-0}"
-export OK_SH_RATE_LIMIT="${OK_SH_RATE_LIMIT:-0}"
-export OK_SH_DESTRUCTIVE="${OK_SH_DESTRUCTIVE:-0}"
-export OK_SH_MARKDOWN="${OK_SH_MARKDOWN:-0}"
-
-# Detect if jq is installed.
-command -v "$OK_SH_JQ_BIN" 1>/dev/null 2>/dev/null
-NO_JQ=$?
-
-# Customizable logging output.
-exec 4>/dev/null
-exec 5>/dev/null
-exec 6>/dev/null
-export LINFO=4 # Info-level log messages.
-export LDEBUG=5 # Debug-level log messages.
-export LSUMMARY=6 # Summary output.
-
-# Generate a carriage return so we can match on it.
-# Using a variable because these are tough to specify in a portable way.
-crlf=$(printf '\r\n')
-
-# ## Main
-# Generic functions not necessarily specific to working with GitHub.
-
-# ### Help
-# Functions for fetching and formatting help text.
-
- _cols() {
- sort | awk '
- { w[NR] = $0 }
- END {
- cols = 3
- per_col = sprintf("%.f", NR / cols + 0.5) # Round up if decimal.
-
- for (i = 1; i < per_col + 1; i += 1) {
- for (j = 0; j < cols; j += 1) {
- printf("%-24s", w[i + per_col * j])
- }
- printf("\n")
- }
- }
- '
- }
- _links() { awk '{ print "* [" $0 "](#" $0 ")" }'; }
- _funcsfmt() { if [ "$OK_SH_MARKDOWN" -eq 0 ]; then _cols; else _links; fi; }
-
-help() {
- # Output the help text for a command
- #
- # Usage:
- #
- # help commandname
- #
- # Positional arguments
- #
- local fname="$1"
- # Function name to search for; if omitted searches whole file.
-
- # Short-circuit if only producing help for a single function.
- if [ $# -gt 0 ]; then
- awk -v fname="^$fname\\\(\\\) \\\{$" '$0 ~ fname, /^}/ { print }' "$0" \
- | _helptext
- return
- fi
-
- _helptext < "$0"
- printf '\n'
- help __main
- printf '\n'
-
- printf '## Table of Contents\n'
- printf '\n### Utility and request/response commands\n\n'
- _all_funcs public=0 | _funcsfmt
- printf '\n### GitHub commands\n\n'
- _all_funcs private=0 | _funcsfmt
- printf '\n## Commands\n\n'
-
- for cmd in $(_all_funcs public=0); do
- printf '### %s\n\n' "$cmd"
- help "$cmd"
- printf '\n'
- done
-
- for cmd in $(_all_funcs private=0); do
- printf '### %s\n\n' "$cmd"
- help "$cmd"
- printf '\n'
- done
-}
-
-_all_funcs() {
- # List all functions found in the current file in the order they appear
- #
- # Keyword arguments
- #
- local public=1
- # `0` do not output public functions.
- local private=1
- # `0` do not output private functions.
-
- for arg in "$@"; do
- case $arg in
- (public=*) public="${arg#*=}";;
- (private=*) private="${arg#*=}";;
- esac
- done
-
- awk -v public="$public" -v private="$private" '
- $1 !~ /^__/ && /^[a-zA-Z0-9_]+\s*\(\)/ {
- sub(/\(\)$/, "", $1)
- if (!public && substr($1, 1, 1) != "_") next
- if (!private && substr($1, 1, 1) == "_") next
- print $1
- }
- ' "$0"
-}
-
-__main() {
- # ## Usage
- #
- # `${NAME} [] (command [, ...])`
- #
- # ${NAME} -h # Short, usage help text.
- # ${NAME} help # All help text. Warning: long!
- # ${NAME} help command # Command-specific help text.
- # ${NAME} command # Run a command with and without args.
- # ${NAME} command foo bar baz=Baz qux='Qux arg here'
- #
- # Flag | Description
- # ---- | -----------
- # -V | Show version.
- # -h | Show this screen.
- # -j | Output raw JSON; don't process with jq.
- # -q | Quiet; don't print to stdout.
- # -r | Print current GitHub API rate limit to stderr.
- # -v | Logging output; specify multiple times: info, debug, trace.
- # -x | Enable xtrace debug logging.
- # -y | Answer 'yes' to any prompts.
- #
- # Flags _must_ be the first argument to `${NAME}`, before `command`.
-
- local cmd
- local ret
- local opt
- local OPTARG
- local OPTIND
- local quiet=0
- local temp_dir
- temp_dir="${TMPDIR-/tmp}/${NAME}.${$}.$(awk 'BEGIN {srand(); printf "%d\n", rand() * 10^10}')"
- local summary_fifo="${temp_dir}/oksh_summary.fifo"
-
- # shellcheck disable=SC2154
- trap '
- excode=$?; trap - EXIT;
- exec 4>&-
- exec 5>&-
- exec 6>&-
- rm -rf '"$temp_dir"'
- exit $excode
- ' INT TERM EXIT
-
- while getopts Vhjqrvxy opt; do
- case $opt in
- V) printf 'Version: %s\n' $VERSION
- exit;;
- h) help __main
- printf '\nAvailable commands:\n\n'
- _all_funcs private=0 | _cols
- printf '\n'
- exit;;
- j) NO_JQ=1;;
- q) quiet=1;;
- r) OK_SH_RATE_LIMIT=1;;
- v) OK_SH_VERBOSE=$(( OK_SH_VERBOSE + 1 ));;
- x) set -x;;
- y) OK_SH_DESTRUCTIVE=1;;
- esac
- done
- shift $(( OPTIND - 1 ))
-
- if [ -z "$1" ] ; then
- printf 'No command given. Available commands:\n\n%s\n' \
- "$(_all_funcs private=0 | _cols)" 1>&2
- exit 1
- fi
-
- [ $OK_SH_VERBOSE -gt 0 ] && exec 4>&2
- [ $OK_SH_VERBOSE -gt 1 ] && exec 5>&2
- if [ $quiet -eq 1 ]; then
- exec 1>/dev/null 2>/dev/null
- fi
-
- if [ "$OK_SH_RATE_LIMIT" -eq 1 ] ; then
- mkdir -m 700 "$temp_dir" || {
- printf 'failed to create temp_dir\n' >&2; exit 1;
- }
- mkfifo "$summary_fifo"
- # Hold the fifo open so it will buffer input until emptied.
- exec 6<>"$summary_fifo"
- fi
-
- # Run the command.
- cmd="$1" && shift
- _log debug "Running command ${cmd}."
- "$cmd" "$@"
- ret=$?
- _log debug "Command ${cmd} exited with ${?}."
-
- # Output any summary messages.
- if [ "$OK_SH_RATE_LIMIT" -eq 1 ] ; then
- cat "$summary_fifo" 1>&2 &
- exec 6>&-
- fi
-
- exit $ret
-}
-
-_log() {
- # A lightweight logging system based on file descriptors
- #
- # Usage:
- #
- # _log debug 'Starting the combobulator!'
- #
- # Positional arguments
- #
- local level="${1:?Level is required.}"
- # The level for a given log message. (info or debug)
- local message="${2:?Message is required.}"
- # The log message.
-
- shift 2
-
- local lname
-
- case "$level" in
- info) lname='INFO'; level=$LINFO ;;
- debug) lname='DEBUG'; level=$LDEBUG ;;
- *) printf 'Invalid logging level: %s\n' "$level" ;;
- esac
-
- printf '%s %s: %s\n' "$NAME" "$lname" "$message" 1>&$level
-}
-
-_helptext() {
- # Extract contiguous lines of comments and function params as help text
- #
- # Indentation will be ignored. She-bangs will be ignored. Local variable
- # declarations and their default values can also be pulled in as
- # documentation. Exits upon encountering the first blank line.
- #
- # Exported environment variables can be used for string interpolation in
- # the extracted commented text.
- #
- # Input
- #
- # * (stdin)
- # The text of a function body to parse.
-
- awk '
- NR != 1 && /^\s*#/ {
- line=$0
- while(match(line, "[$]{[^}]*}")) {
- var=substr(line, RSTART+2, RLENGTH -3)
- gsub("[$]{"var"}", ENVIRON[var], line)
- }
- gsub(/^\s*#\s?/, "", line)
- print line
- }
- /^\s*local/ {
- sub(/^\s*local /, "")
- sub(/\$\{/, "$", $0)
- sub(/:.*}/, "", $0)
- print "* `" $0 "`\n"
- }
- !NF { exit }'
-}
-
-# ### Request-response
-# Functions for making HTTP requests and processing HTTP responses.
-
-_format_json() {
- # Create formatted JSON from name=value pairs
- #
- # Usage:
- # ```
- # ok.sh _format_json foo=Foo bar=123 baz=true qux=Qux=Qux quux='Multi-line
- # string' quuz=\'5.20170918\' \
- # corge="$(ok.sh _format_json grault=Grault)" \
- # garply="$(ok.sh _format_json -a waldo true 3)"
- # ```
- #
- # Return:
- # ```
- # {
- # "garply": [
- # "waldo",
- # true,
- # 3
- # ],
- # "foo": "Foo",
- # "corge": {
- # "grault": "Grault"
- # },
- # "baz": true,
- # "qux": "Qux=Qux",
- # "quux": "Multi-line\nstring",
- # "quuz": "5.20170918",
- # "bar": 123
- # }
- # ```
- #
- # Tries not to quote numbers, booleans, nulls, or nested structures.
- # Note, nested structures must be quoted since the output contains spaces.
- #
- # The `-a` option will create an array instead of an object. This option
- # must come directly after the _format_json command and before any
- # operands. E.g., `_format_json -a foo bar baz`.
- #
- # If jq is installed it will also validate the output.
- #
- # Positional arguments
- #
- # * $1 - $9
- #
- # Each positional arg must be in the format of `name=value` which will be
- # added to a single, flat JSON object.
-
- local opt
- local OPTIND
- local is_array=0
- local use_env=1
- while getopts a opt; do
- case $opt in
- a) is_array=1; unset use_env;;
- esac
- done
- shift $(( OPTIND - 1 ))
-
- _log debug "Formatting ${#} parameters as JSON."
-
- env -i -- ${use_env+"$@"} awk -v is_array="$is_array" '
- function isnum(x){ return (x == x + 0) }
- function isnull(x){ return (x == "null" ) }
- function isbool(x){ if (x == "true" || x == "false") return 1 }
- function isnested(x) {
- if (substr(x, 0, 1) == "[" || substr(x, 0, 1) == "{") {
- return 1
- }
- }
- function castOrQuote(val) {
- if (!isbool(val) && !isnum(val) && !isnull(val) && !isnested(val)) {
- sub(/^('\''|")/, "", val) # Remove surrounding quotes
- sub(/('\''|")$/, "", val)
-
- gsub(/"/, "\\\"", val) # Escape double-quotes.
- gsub(/\n/, "\\n", val) # Replace newlines with \n text.
- val = "\"" val "\""
- return val
- } else {
- return val
- }
- }
-
- BEGIN {
- printf("%s", is_array ? "[" : "{")
-
- for (i = 1; i < length(ARGV); i += 1) {
- arg = ARGV[i]
-
- if (is_array == 1) {
- val = castOrQuote(arg)
- printf("%s%s", sep, val)
- } else {
- name = substr(arg, 0, index(arg, "=") - 1)
- val = castOrQuote(ENVIRON[name])
- printf("%s\"%s\": %s", sep, name, val)
- }
-
- sep = ", "
- ARGV[i] = ""
- }
- printf("%s", is_array ? "]" : "}")
- }' "$@"
-}
-
-_format_urlencode() {
- # URL encode and join name=value pairs
- #
- # Usage:
- # ```
- # _format_urlencode foo='Foo Foo' bar='&/Bar/'
- # ```
- #
- # Return:
- # ```
- # foo=Foo%20Foo&bar=%3CBar%3E%26%2FBar%2F
- # ```
- #
- # Ignores pairs if the value begins with an underscore.
-
- _log debug "Formatting ${#} parameters as urlencoded"
-
- env -i -- "$@" awk '
- function escape(str, c, i, len, res) {
- len = length(str)
- res = ""
- for (i = 1; i <= len; i += 1) {
- c = substr(str, i, 1);
- if (c ~ /[0-9A-Za-z]/)
- res = res c
- else
- res = res "%" sprintf("%02X", ord[c])
- }
- return res
- }
-
- BEGIN {
- for (i = 0; i <= 255; i += 1) ord[sprintf("%c", i)] = i;
-
- for (j = 1; j < length(ARGV); j += 1) {
- arg = ARGV[j]
- name = substr(arg, 0, index(arg, "=") - 1)
- if (substr(name, 1, 1) == "_") continue
- val = ENVIRON[name]
-
- printf("%s%s=%s", sep, name, escape(val))
- sep = "&"
- ARGV[j] = ""
- }
- }' "$@"
-}
-
-_filter_json() {
- # Filter JSON input using jq; outputs raw JSON if jq is not installed
- #
- # Usage:
- #
- # printf '[{"foo": "One"}, {"foo": "Two"}]' | \
- # ok.sh _filter_json '.[] | "\(.foo)"'
- #
- # * (stdin)
- # JSON input.
- local _filter="$1"
- # A string of jq filters to apply to the input stream.
-
- _log debug 'Filtering JSON.'
-
- if [ $NO_JQ -ne 0 ] ; then
- _log debug 'Bypassing jq processing.'
- cat
- return
- fi
-
- "${OK_SH_JQ_BIN}" -c -r "${_filter}" || printf 'jq parse error; invalid JSON.\n' 1>&2
-}
-
-_get_mime_type() {
- # Guess the mime type for a file based on the file extension
- #
- # Usage:
- #
- # local mime_type
- # _get_mime_type "foo.tar"; printf 'mime is: %s' "$mime_type"
- #
- # Sets the global variable `mime_type` with the result. (If this function
- # is called from within a function that has declared a local variable of
- # that name it will update the local copy and not set a global.)
- #
- # Positional arguments
- #
- local filename="${1:?Filename is required.}"
- # The full name of the file, with extension.
-
- # Taken from Apache's mime.types file (public domain).
- case "$filename" in
- *.bz2) mime_type=application/x-bzip2 ;;
- *.exe) mime_type=application/x-msdownload ;;
- *.tar.gz | *.gz | *.tgz) mime_type=application/x-gzip ;;
- *.jpg | *.jpeg | *.jpe | *.jfif) mime_type=image/jpeg ;;
- *.json) mime_type=application/json ;;
- *.pdf) mime_type=application/pdf ;;
- *.png) mime_type=image/png ;;
- *.rpm) mime_type=application/x-rpm ;;
- *.svg | *.svgz) mime_type=image/svg+xml ;;
- *.tar) mime_type=application/x-tar ;;
- *.txt) mime_type=text/plain ;;
- *.yaml) mime_type=application/x-yaml ;;
- *.apk) mime_type=application/vnd.android.package-archive ;;
- *.zip) mime_type=application/zip ;;
- *.jar) mime_type=application/java-archive ;;
- *.war) mime_type=application/zip ;;
- esac
-
- _log debug "Guessed mime type of '${mime_type}' for '${filename}'."
-}
-
-_get_confirm() {
- # Prompt the user for confirmation
- #
- # Usage:
- #
- # local confirm; _get_confirm
- # [ "$confirm" -eq 1 ] && printf 'Good to go!\n'
- #
- # If global confirmation is set via `$OK_SH_DESTRUCTIVE` then the user
- # is not prompted. Assigns the user's confirmation to the `confirm` global
- # variable. (If this function is called within a function that has a local
- # variable of that name, the local variable will be updated instead.)
- #
- # Positional arguments
- #
- local message="${1:-Are you sure?}"
- # The message to prompt the user with.
-
- local answer
-
- if [ "$OK_SH_DESTRUCTIVE" -eq 1 ] ; then
- confirm=$OK_SH_DESTRUCTIVE
- return
- fi
-
- printf '%s ' "$message"
- read -r answer
-
- ! printf '%s\n' "$answer" | grep -Eq "$(locale yesexpr)"
- confirm=$?
-}
-
-_opts_filter() {
- # Extract common jq filter keyword options and assign to vars
- #
- # Usage:
- #
- # local filter
- # _opts_filter "$@"
-
- for arg in "$@"; do
- case $arg in
- (_filter=*) _filter="${arg#*=}";;
- esac
- done
-}
-
-_opts_pagination() {
- # Extract common pagination keyword options and assign to vars
- #
- # Usage:
- #
- # local _follow_next
- # _opts_pagination "$@"
-
- for arg in "$@"; do
- case $arg in
- (_follow_next=*) _follow_next="${arg#*=}";;
- (_follow_next_limit=*) _follow_next_limit="${arg#*=}";;
- esac
- done
-}
-
-_opts_qs() {
- # Extract common query string keyword options and assign to vars
- #
- # Usage:
- #
- # local qs
- # _opts_qs "$@"
- # _get "/some/path${qs}"
-
- local querystring
- querystring=$(_format_urlencode "$@")
- qs="${querystring:+?$querystring}"
-}
-
-_request() {
- # A wrapper around making HTTP requests with curl
- #
- # Usage:
- # ```
- # # Get JSON for all issues:
- # _request /repos/saltstack/salt/issues
- #
- # # Send a POST request; parse response using jq:
- # printf '{"title": "%s", "body": "%s"}\n' "Stuff" "Things" \
- # | _request /some/path | jq -r '.[url]'
- #
- # # Send a PUT request; parse response using jq:
- # printf '{"title": "%s", "body": "%s"}\n' "Stuff" "Things" \
- # | _request /repos/:owner/:repo/issues method=PUT | jq -r '.[url]'
- #
- # # Send a conditional-GET request:
- # _request /users etag=edd3a0d38d8c329d3ccc6575f17a76bb
- # ```
- #
- # Input
- #
- # * (stdin)
- # Data that will be used as the request body.
- #
- # Positional arguments
- #
- local path="${1:?Path is required.}"
- # The URL path for the HTTP request.
- # Must be an absolute path that starts with a `/` or a full URL that
- # starts with http(s). Absolute paths will be append to the value in
- # `$OK_SH_URL`.
- #
- # Keyword arguments
- #
- local method='GET'
- # The method to use for the HTTP request.
- local content_type='application/json'
- # The value of the Content-Type header to use for the request.
- local etag
- # An optional Etag to send as the If-None-Match header.
-
- shift 1
-
- local cmd
- local arg
- local has_stdin
- local trace_curl
-
- case $path in
- (http*) : ;;
- *) path="${OK_SH_URL}${path}" ;;
- esac
-
- for arg in "$@"; do
- case $arg in
- (method=*) method="${arg#*=}";;
- (content_type=*) content_type="${arg#*=}";;
- (etag=*) etag="${arg#*=}";;
- esac
- done
-
- case "$method" in
- POST | PUT | PATCH) has_stdin=1;;
- esac
-
- [ $OK_SH_VERBOSE -eq 3 ] && trace_curl=1
-
- [ "$OK_SH_VERBOSE" -eq 1 ] && set -x
- # shellcheck disable=SC2086
- curl -nsSig \
- -H "Accept: ${OK_SH_ACCEPT}" \
- -H "Content-Type: ${content_type}" \
- ${GITHUB_TOKEN:+-H "Authorization: token ${GITHUB_TOKEN}"} \
- ${etag:+-H "If-None-Match: \"${etag}\""} \
- ${has_stdin:+--data-binary @-} \
- ${trace_curl:+--trace-ascii /dev/stderr} \
- -X "${method}" \
- "${path}"
- set +x
-}
-
-_response() {
- # Process an HTTP response from curl
- #
- # Output only headers of interest followed by the response body. Additional
- # processing is performed on select headers to make them easier to parse
- # using shell tools.
- #
- # Usage:
- # ```
- # # Send a request; output the response and only select response headers:
- # _request /some/path | _response status_code ETag Link_next
- #
- # # Make request using curl; output response with select response headers;
- # # assign response headers to local variables:
- # curl -isS example.com/some/path | _response status_code status_text | {
- # local status_code status_text
- # read -r status_code
- # read -r status_text
- # }
- # ```
- #
- # Header reformatting
- #
- # * HTTP Status
- #
- # The HTTP line is split into separate `http_version`, `status_code`, and
- # `status_text` variables.
- #
- # * ETag
- #
- # The surrounding quotes are removed.
- #
- # * Link
- #
- # Each URL in the Link header is expanded with the URL type appended to
- # the name. E.g., `Link_first`, `Link_last`, `Link_next`.
- #
- # Positional arguments
- #
- # * $1 - $9
- #
- # Each positional arg is the name of an HTTP header. Each header value is
- # output in the same order as each argument; each on a single line. A
- # blank line is output for headers that cannot be found.
-
- local hdr
- local val
- local http_version
- local status_code=100
- local status_text
- local headers output
-
- _log debug 'Processing response.'
-
- while [ "${status_code}" = "100" ]; do
- read -r http_version status_code status_text
- status_text="${status_text%${crlf}}"
- http_version="${http_version#HTTP/}"
-
- _log debug "Response status is: ${status_code} ${status_text}"
-
- if [ "${status_code}" = "100" ]; then
- _log debug "Ignoring response '${status_code} ${status_text}', skipping to real response."
- while IFS=": " read -r hdr val; do
- # Headers stop at the first blank line.
- [ "$hdr" = "$crlf" ] && break
- val="${val%${crlf}}"
- _log debug "Unexpected additional header: ${hdr}: ${val}"
- done
-
- fi
- done
-
- headers="HTTP_VERSION: ${http_version}
-STATUS_CODE: ${status_code}
-STATUS_TEXT: ${status_text}
-"
- while IFS=": " read -r hdr val; do
- # Headers stop at the first blank line.
- [ "$hdr" = "$crlf" ] && break
- val="${val%${crlf}}"
-
- # Headers are case insensitive
- hdr="$(printf '%s' "$hdr" | awk '{print toupper($0)}')"
-
- # Process each header; reformat some to work better with sh tools.
- case "$hdr" in
- # Update the GitHub rate limit trackers.
- X-RATELIMIT-REMAINING)
- printf 'GitHub remaining requests: %s\n' "$val" 1>&$LSUMMARY ;;
- X-RATELIMIT-RESET)
- awk -v gh_reset="$val" 'BEGIN {
- srand(); curtime = srand()
- print "GitHub seconds to reset: " gh_reset - curtime
- }' 1>&$LSUMMARY ;;
-
- # Remove quotes from the etag header.
- ETAG) val="${val#\"}"; val="${val%\"}" ;;
-
- # Split the URLs in the Link header into separate pseudo-headers.
- LINK) headers="${headers}$(printf '%s' "$val" | awk '
- BEGIN { RS=", "; FS="; "; OFS=": " }
- {
- sub(/^rel="/, "", $2); sub(/"$/, "", $2)
- sub(/^ *, "", $1); sub(/>$/, "", $1)
- print "LINK_" toupper($2), $1
- }')
-" # need trailing newline
- ;;
- esac
-
- headers="${headers}${hdr}: ${val}
-" # need trailing newline
-
- done
-
- # Output requested headers in deterministic order.
- for arg in "$@"; do
- _log debug "Outputting requested header '${arg}'."
- arg="$(printf '%s' "$arg" | awk '{print toupper($0)}')"
- output=$(printf '%s' "$headers" | while IFS=": " read -r hdr val; do
- [ "$hdr" = "$arg" ] && printf '%s' "$val"
- done)
- printf '%s\n' "$output"
- done
-
- # Output the response body.
- cat
-}
-
-_get() {
- # A wrapper around _request() for common GET patterns
- #
- # Will automatically follow 'next' pagination URLs in the Link header.
- #
- # Usage:
- #
- # _get /some/path
- # _get /some/path _follow_next=0
- # _get /some/path _follow_next_limit=200 | jq -c .
- #
- # Positional arguments
- #
- local path="${1:?Path is required.}"
- # The HTTP path or URL to pass to _request().
- #
- # Keyword arguments
- #
- # * _follow_next=1
- #
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- #
- # * _follow_next_limit=50
- #
- # Maximum number of 'next' URLs to follow before stopping.
-
- shift 1
- local status_code
- local status_text
- local next_url
-
- # If the variable is unset or empty set it to a default value. Functions
- # that call this function can pass these parameters in one of two ways:
- # explicitly as a keyword arg or implicitly by setting variables of the same
- # names within the local scope.
- # shellcheck disable=SC2086
- if [ -z ${_follow_next+x} ] || [ -z "${_follow_next}" ]; then
- local _follow_next=1
- fi
- # shellcheck disable=SC2086
- if [ -z ${_follow_next_limit+x} ] || [ -z "${_follow_next_limit}" ]; then
- local _follow_next_limit=50
- fi
-
- _opts_pagination "$@"
-
- _request "$path" | _response status_code status_text Link_next | {
- read -r status_code
- read -r status_text
- read -r next_url
-
- case "$status_code" in
- 20*) : ;;
- 4*) printf 'Client Error: %s %s\n' \
- "$status_code" "$status_text" 1>&2; exit 1 ;;
- 5*) printf 'Server Error: %s %s\n' \
- "$status_code" "$status_text" 1>&2; exit 1 ;;
- esac
-
- # Output response body.
- cat
-
- [ "$_follow_next" -eq 1 ] || return
-
- _log info "Remaining next link follows: ${_follow_next_limit}"
- if [ -n "$next_url" ] && [ $_follow_next_limit -gt 0 ] ; then
- _follow_next_limit=$(( _follow_next_limit - 1 ))
-
- _get "$next_url" "_follow_next_limit=${_follow_next_limit}"
- fi
- }
-}
-
-_post() {
- # A wrapper around _request() for common POST / PUT patterns
- #
- # Usage:
- #
- # _format_json foo=Foo bar=Bar | _post /some/path
- # _format_json foo=Foo bar=Bar | _post /some/path method='PUT'
- # _post /some/path filename=somearchive.tar
- # _post /some/path filename=somearchive.tar mime_type=application/x-tar
- # _post /some/path filename=somearchive.tar \
- # mime_type=$(file -b --mime-type somearchive.tar)
- #
- # Input
- #
- # * (stdin)
- # Optional. See the `filename` argument also.
- # Data that will be used as the request body.
- #
- # Positional arguments
- #
- local path="${1:?Path is required.}"
- # The HTTP path or URL to pass to _request().
- #
- # Keyword arguments
- #
- local method='POST'
- # The method to use for the HTTP request.
- local filename
- # Optional. See the `stdin` option above also.
- # Takes precedence over any data passed as stdin and loads a file off the
- # file system to serve as the request body.
- local mime_type
- # The value of the Content-Type header to use for the request.
- # If the `filename` argument is given this value will be guessed from the
- # file extension. If the `filename` argument is not given (i.e., using
- # stdin) this value defaults to `application/json`. Specifying this
- # argument overrides all other defaults or guesses.
-
- shift 1
-
- for arg in "$@"; do
- case $arg in
- (method=*) method="${arg#*=}";;
- (filename=*) filename="${arg#*=}";;
- (mime_type=*) mime_type="${arg#*=}";;
- esac
- done
-
- # Make either the file or stdin available as fd7.
- if [ -n "$filename" ] ; then
- if [ -r "$filename" ] ; then
- _log debug "Using '${filename}' as POST data."
- [ -n "$mime_type" ] || _get_mime_type "$filename"
- : ${mime_type:?The MIME type could not be guessed.}
- exec 7<"$filename"
- else
- printf 'File could not be found or read.\n' 1>&2
- exit 1
- fi
- else
- _log debug "Using stdin as POST data."
- mime_type='application/json'
- exec 7<&0
- fi
-
- _request "$path" method="$method" content_type="$mime_type" 0<&7 \
- | _response status_code status_text \
- | {
- read -r status_code
- read -r status_text
-
- case "$status_code" in
- 20*) : ;;
- 4*) printf 'Client Error: %s %s\n' \
- "$status_code" "$status_text" 1>&2; exit 1 ;;
- 5*) printf 'Server Error: %s %s\n' \
- "$status_code" "$status_text" 1>&2; exit 1 ;;
- esac
-
- # Output response body.
- cat
- }
-}
-
-_delete() {
- # A wrapper around _request() for common DELETE patterns
- #
- # Usage:
- #
- # _delete '/some/url'
- #
- # Return: 0 for success; 1 for failure.
- #
- # Positional arguments
- #
- local url="${1:?URL is required.}"
- # The URL to send the DELETE request to.
-
- local status_code
-
- _request "${url}" method='DELETE' | _response status_code | {
- read -r status_code
- [ "$status_code" = "204" ]
- exit $?
- }
-}
-
-# ## GitHub
-# Friendly functions for common GitHub tasks.
-
-# ### Authorization
-# Perform authentication and authorization.
-
-show_scopes() {
- # Show the permission scopes for the currently authenticated user
- #
- # Usage:
- #
- # show_scopes
-
- local oauth_scopes
-
- _request '/' | _response X-OAuth-Scopes | {
- read -r oauth_scopes
-
- printf '%s\n' "$oauth_scopes"
-
- # Dump any remaining response body.
- cat >/dev/null
- }
-}
-
-# ### Repository
-# Create, update, delete, list repositories.
-
-org_repos() {
- # List organization repositories
- #
- # Usage:
- #
- # org_repos myorg
- # org_repos myorg type=private per_page=10
- # org_repos myorg _filter='.[] | "\(.name)\t\(.owner.login)"'
- #
- # Positional arguments
- #
- local org="${1:?Org name required.}"
- # Organization GitHub login or id for which to list repos.
- #
- # Keyword arguments
- #
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.name)\t\(.ssh_url)"'
- # A jq filter to apply to the return data.
- #
- # Querystring arguments may also be passed as keyword arguments:
- #
- # * `per_page`
- # * `type`
-
- shift 1
- local qs
-
- _opts_pagination "$@"
- _opts_filter "$@"
- _opts_qs "$@"
-
- _get "/orgs/${org}/repos${qs}" | _filter_json "${_filter}"
-}
-
-org_teams() {
- # List teams
- #
- # Usage:
- #
- # org_teams org
- #
- # Positional arguments
- #
- local org="${1:?Org name required.}"
- # Organization GitHub login or id.
- #
- # Keyword arguments
- #
- local _filter='.[] | "\(.name)\t\(.id)\t\(.permission)"'
- # A jq filter to apply to the return data.
-
- shift 1
-
- _opts_filter "$@"
-
- _get "/orgs/${org}/teams" \
- | _filter_json "${_filter}"
-}
-
-org_members() {
- # List organization members
- #
- # Usage:
- #
- # org_members org
- #
- # Positional arguments
- #
- local org="${1:?Org name required.}"
- # Organization GitHub login or id.
- #
- # Keyword arguments
- #
- local _filter='.[] | "\(.login)\t\(.id)"'
- # A jq filter to apply to the return data.
-
- local qs
-
- shift 1
-
- _opts_filter "$@"
- _opts_qs "$@"
-
- _get "/orgs/${org}/members${qs}" | _filter_json "${_filter}"
-}
-
-org_collaborators() {
- # List organization outside collaborators
- #
- # Usage:
- #
- # org_collaborators org
- #
- # Positional arguments
- #
- local org="${1:?Org name required.}"
- # Organization GitHub login or id.
- #
- # Keyword arguments
- #
- local _filter='.[] | "\(.login)\t\(.id)"'
- # A jq filter to apply to the return data.
-
- local qs
-
- shift 1
-
- _opts_filter "$@"
- _opts_qs "$@"
-
- _get "/orgs/${org}/outside_collaborators${qs}" | _filter_json "${_filter}"
-}
-
-org_auditlog() {
- # Interact with the Github Audit Log
- #
- # Usage:
- #
- # org_auditlog org
- #
- # Positional arguments
- #
- local org="${1:?Org name required.}"
- # Organization GitHub login or id.
- #
- # Keyword arguments
- #
- local _filter='.[] | "\(.actor)\t\(.action)"'
- # A jq filter to apply to the return data.
-
- local qs
-
- shift 1
-
- _opts_filter "$@"
- _opts_qs "$@"
-
- _get "/orgs/${org}/audit-log${qs}" | _filter_json "${_filter}"
-}
-
-team_members() {
- # List team members
- #
- # Usage:
- #
- # team_members team_id
- #
- # Positional arguments
- #
- local team_id="${1:?Team id required.}"
- # Team id.
- #
- # Keyword arguments
- #
- local _filter='.[] | "\(.login)\t\(.id)"'
- # A jq filter to apply to the return data.
-
- shift 1
-
- _opts_filter "$@"
-
- _get "/teams/${team_id}/members" \
- | _filter_json "${_filter}"
-
-}
-
-list_repos() {
- # List user repositories
- #
- # Usage:
- #
- # list_repos
- # list_repos user
- #
- # Positional arguments
- #
- local user="$1"
- # Optional GitHub user login or id for which to list repos.
- #
- # Keyword arguments
- #
- local _filter='.[] | "\(.name)\t\(.html_url)"'
- # A jq filter to apply to the return data.
- #
- # Querystring arguments may also be passed as keyword arguments:
- #
- # * `direction`
- # * `per_page`
- # * `sort`
- # * `type`
-
- # User is optional; is this a keyword arg?
- case "$user" in *=*) user='' ;; esac
- if [ -n "$user" ]; then shift 1; fi
-
- local qs
-
- _opts_filter "$@"
- _opts_qs "$@"
-
- if [ -n "$user" ] ; then
- url="/users/${user}/repos"
- else
- url='/user/repos'
- fi
-
- _get "${url}${qs}" | _filter_json "${_filter}"
-}
-
-list_branches() {
- # List branches of a specified repository.
- # ( https://developer.github.com/v3/repos/#list_branches )
- #
- # Usage:
- #
- # list_branches user repo
- #
- # Positional arguments
- #
- # GitHub user login or id for which to list branches
- # Name of the repo for which to list branches
- #
- local user="${1:?User name required.}"
- local repo="${2:?Repo name required.}"
- shift 2
- #
- # Keyword arguments
- #
- local _filter='.[] | "\(.name)"'
- # A jq filter to apply to the return data.
- #
- # Querystring arguments may also be passed as keyword arguments:
- #
- # * `direction`
- # * `per_page`
- # * `sort`
- # * `type`
-
- local qs
-
- _opts_filter "$@"
- _opts_qs "$@"
-
- url="/repos/${user}/${repo}/branches"
-
- _get "${url}${qs}" | _filter_json "${_filter}"
-}
-
-list_commits() {
- # List commits of a specified repository.
- # ( https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository )
- #
- # Usage:
- #
- # list_commits user repo
- #
- # Positional arguments
- #
- # GitHub user login or id for which to list branches
- # Name of the repo for which to list branches
- #
-
- local user="${1:?User name required.}"
- local repo="${2:?Repo name required.}"
- shift 2
-
- # A jq filter to apply to the return data.
- #
-
- local _filter='.[] | "\(.sha) \(.author.login) \(.commit.author.email) \(.committer.login) \(.commit.committer.email)"'
-
- # Querystring arguments may also be passed as keyword arguments:
- #
- # * `sha`
- # * `path`
- # * `author`
- # * `since` Only commits after this date will be returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
- # * `until`
-
- local qs
-
- _opts_filter "$@"
- _opts_qs "$@"
-
- url="/repos/${user}/${repo}/commits"
-
- _get "${url}${qs}" | _filter_json "${_filter}"
-}
-
-list_contributors() {
- # List contributors to the specified repository, sorted by the number of commits per contributor in descending order.
- # ( https://developer.github.com/v3/repos/#list-contributors )
- #
- # Usage:
- #
- # list_contributors user repo
- #
- # Positional arguments
- #
- local user="${1:?User name required.}"
- # GitHub user login or id for which to list contributors
- local repo="${2:?Repo name required.}"
- # Name of the repo for which to list contributors
- #
- # Keyword arguments
- #
- local _filter='.[] | "\(.login)\t\(.type)\tType:\(.type)\tContributions:\(.contributions)"'
- # A jq filter to apply to the return data.
- #
- # Querystring arguments may also be passed as keyword arguments:
- #
- # * `direction`
- # * `per_page`
- # * `sort`
- # * `type`
-
- shift 2
-
- local qs
-
- _opts_filter "$@"
- _opts_qs "$@"
-
- url="/repos/${user}/${repo}/contributors"
-
- _get "${url}${qs}" | _filter_json "${_filter}"
-}
-
-list_collaborators() {
- # List collaborators to the specified repository, sorted by the number of commits per collaborator in descending order.
- # ( https://developer.github.com/v3/repos/#list-collaborators )
- #
- # Usage:
- #
- # list_collaborators someuser/somerepo
- #
- # Positional arguments
- # GitHub user login or id for which to list collaborators
- # Name of the repo for which to list collaborators
- #
- local repo="${1:?Repo name required.}"
- #
- # Keyword arguments
- #
- local _filter='.[] | "\(.login)\t\(.type)\tType:\(.type)\tPermissions:\(.permissions)"'
- # A jq filter to apply to the return data.
- #
- # Querystring arguments may also be passed as keyword arguments:
- #
- # * `direction`
- # * `per_page`
- # * `sort`
- # * `type`
-
- shift 1
-
- local qs
-
- _opts_filter "$@"
- _opts_qs "$@"
-
- url="/repos/${repo}/collaborators"
-
- _get "${url}${qs}" | _filter_json "${_filter}"
-}
-
-list_hooks() {
- # List webhooks from the specified repository.
- # ( https://developer.github.com/v3/repos/hooks/#list-hooks )
- #
- # Usage:
- #
- # list_hooks owner/repo
- #
- # Positional arguments
- #
- local repo="${1:?Repo name required.}"
- # Name of the repo for which to list contributors
- # Owner is mandatory, like 'owner/repo'
- #
- local _filter='.[] | "\(.name)\t\(.config.url)"'
- # A jq filter to apply to the return data.
- #
-
- shift 1
-
- _opts_filter "$@"
-
- url="/repos/${repo}/hooks"
-
- _get "${url}" | _filter_json "${_filter}"
-}
-
-list_gists() {
- # List gists for the current authenticated user or a specific user
- #
- # https://developer.github.com/v3/gists/#list-a-users-gists
- #
- # Usage:
- #
- # list_gists
- # list_gists
- #
- # Positional arguments
- #
- local username="$1"
- # An optional user to filter listing
- #
- # Keyword arguments
- #
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.id)\t\(.description)"'
- # A jq filter to apply to the return data.
-
- local url
- case "$username" in
- ('') url='/gists';;
- (*=*) url='/gists';;
- (*) url="/users/${username}/gists"; shift 1;;
- esac
-
- _opts_pagination "$@"
- _opts_filter "$@"
-
- _get "${url}" | _filter_json "${_filter}"
-}
-
-public_gists() {
- # List public gists
- #
- # https://developer.github.com/v3/gists/#list-all-public-gists
- #
- # Usage:
- #
- # public_gists
- #
- # Keyword arguments
- #
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.id)\t\(.description)"'
- # A jq filter to apply to the return data.
-
- _opts_pagination "$@"
- _opts_filter "$@"
-
- _get '/gists/public' | _filter_json "${_filter}"
-}
-
-gist() {
- # Get a single gist
- #
- # https://developer.github.com/v3/gists/#get-a-single-gist
- #
- # Usage:
- #
- # get_gist
- #
- # Positional arguments
- #
- local gist_id="${1:?Gist ID required.}"
- # ID of gist to fetch.
- #
- # Keyword arguments
- #
- local _filter='.files | keys | join(", ")'
- # A jq filter to apply to the return data.
-
- shift 1
-
- _opts_filter "$@"
-
- _get "/gists/${gist_id}" | _filter_json "${_filter}"
-}
-
-add_collaborator() {
- # Add a collaborator to a repository
- #
- # Usage:
- #
- # add_collaborator someuser/somerepo collaboratoruser permission
- #
- # Positional arguments
- #
- local repo="${1:?Repo name required.}"
- # A GitHub repository.
- local collaborator="${2:?Collaborator name required.}"
- # A new collaborator.
- local permission="${3:?Permission required. One of: push pull admin}"
- # The permission level for this collaborator. One of `push`, `pull`,
- # `admin`. The `pull` and `admin` permissions are valid for organization
- # repos only.
- case $permission in
- push|pull|admin) :;;
- *) printf 'Permission invalid: %s\nMust be one of: push pull admin\n' \
- "$permission" 1>&2; exit 1 ;;
- esac
- #
- # Keyword arguments
- #
- local _filter='"\(.name)\t\(.color)"'
- # A jq filter to apply to the return data.
-
- _opts_filter "$@"
-
- _format_json permission="$permission" \
- | _post "/repos/${repo}/collaborators/${collaborator}" method='PUT' \
- | _filter_json "$_filter"
-}
-
-delete_collaborator() {
- # Delete a collaborator to a repository
- #
- # Usage:
- #
- # delete_collaborator someuser/somerepo collaboratoruser permission
- #
- # Positional arguments
- #
- local repo="${1:?Repo name required.}"
- # A GitHub repository.
- local collaborator="${2:?Collaborator name required.}"
- # A new collaborator.
-
- shift 2
-
- local confirm
-
- _get_confirm 'This will permanently delete the collaborator from this repo. Continue?'
- [ "$confirm" -eq 1 ] || exit 0
-
- _delete "/repos/${repo}/collaborators/${collaborator}"
- exit $?
-}
-
-create_repo() {
- # Create a repository for a user or organization
- #
- # Usage:
- #
- # create_repo foo
- # create_repo bar description='Stuff and things' homepage='example.com'
- # create_repo baz organization=myorg
- #
- # Positional arguments
- #
- local name="${1:?Repo name required.}"
- # Name of the new repo
- #
- # Keyword arguments
- #
- local _filter='"\(.name)\t\(.html_url)"'
- # A jq filter to apply to the return data.
- #
- # POST data may also be passed as keyword arguments:
- #
- # * `auto_init`,
- # * `description`
- # * `gitignore_template`
- # * `has_downloads`
- # * `has_issues`
- # * `has_wiki`,
- # * `homepage`
- # * `organization`
- # * `private`
- # * `team_id`
-
- shift 1
-
- _opts_filter "$@"
-
- local url
- local organization
-
- for arg in "$@"; do
- case $arg in
- (organization=*) organization="${arg#*=}";;
- esac
- done
-
- if [ -n "$organization" ] ; then
- url="/orgs/${organization}/repos"
- else
- url='/user/repos'
- fi
-
- export OK_SH_ACCEPT="application/vnd.github.nebula-preview+json"
- _format_json "name=${name}" "$@" | _post "$url" | _filter_json "${_filter}"
-}
-
-delete_repo() {
- # Delete a repository for a user or organization
- #
- # Usage:
- #
- # delete_repo owner repo
- #
- # The currently authenticated user must have the `delete_repo` scope. View
- # current scopes with the `show_scopes()` function.
- #
- # Positional arguments
- #
- local owner="${1:?Owner name required.}"
- # Name of the new repo
- local repo="${2:?Repo name required.}"
- # Name of the new repo
-
- shift 2
-
- local confirm
-
- _get_confirm 'This will permanently delete a repository! Continue?'
- [ "$confirm" -eq 1 ] || exit 0
-
- _delete "/repos/${owner}/${repo}"
- exit $?
-}
-
-fork_repo() {
- # Fork a repository from a user or organization to own account or organization
- #
- # Usage:
- #
- # fork_repo owner repo
- #
- # Positional arguments
- #
- local owner="${1:?Owner name required.}"
- # Name of existing user or organization
- local repo="${2:?Repo name required.}"
- # Name of the existing repo
- #
- #
- # Keyword arguments
- #
- local _filter='"\(.clone_url)\t\(.ssh_url)"'
- # A jq filter to apply to the return data.
- #
- # POST data may also be passed as keyword arguments:
- #
- # * `organization` (The organization to clone into; default: your personal account)
-
- shift 2
-
- _opts_filter "$@"
-
- _format_json "$@" | _post "/repos/${owner}/${repo}/forks" \
- | _filter_json "${_filter}"
- exit $? # might take a bit time...
-}
-
-# ### Releases
-# Create, update, delete, list releases.
-
-list_releases() {
- # List releases for a repository
- #
- # https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
- #
- # Usage:
- #
- # list_releases org repo '\(.assets[0].name)\t\(.name.id)'
- #
- # Positional arguments
- #
- local owner="${1:?Owner name required.}"
- # A GitHub user or organization.
- local repo="${2:?Repo name required.}"
- # A GitHub repository.
- #
- # Keyword arguments
- #
- local _filter='.[] | "\(.name)\t\(.tag_name)\t\(.id)\t\(.html_url)"'
- # A jq filter to apply to the return data.
-
- shift 2
-
- _opts_filter "$@"
-
- _get "/repos/${owner}/${repo}/releases" \
- | _filter_json "${_filter}"
-}
-
-release() {
- # Get a release
- #
- # https://developer.github.com/v3/repos/releases/#get-a-single-release
- #
- # Usage:
- #
- # release user repo 1087855
- #
- # Positional arguments
- #
- local owner="${1:?Owner name required.}"
- # A GitHub user or organization.
- local repo="${2:?Repo name required.}"
- # A GitHub repository.
- local release_id="${3:?Release ID required.}"
- # The unique ID of the release; see list_releases.
- #
- # Keyword arguments
- #
- local _filter='"\(.author.login)\t\(.published_at)"'
- # A jq filter to apply to the return data.
-
- shift 3
-
- _opts_filter "$@"
-
- _get "/repos/${owner}/${repo}/releases/${release_id}" \
- | _filter_json "${_filter}"
-}
-
-create_release() {
- # Create a release
- #
- # https://developer.github.com/v3/repos/releases/#create-a-release
- #
- # Usage:
- #
- # create_release org repo v1.2.3
- # create_release user repo v3.2.1 draft=true
- #
- # Positional arguments
- #
- local owner="${1:?Owner name required.}"
- # A GitHub user or organization.
- local repo="${2:?Repo name required.}"
- # A GitHub repository.
- local tag_name="${3:?Tag name required.}"
- # Git tag from which to create release.
- #
- # Keyword arguments
- #
- local _filter='"\(.name)\t\(.id)\t\(.html_url)"'
- # A jq filter to apply to the return data.
- #
- # POST data may also be passed as keyword arguments:
- #
- # * `body`
- # * `draft`
- # * `name`
- # * `prerelease`
- # * `target_commitish`
-
- shift 3
-
- _opts_filter "$@"
-
- _format_json "tag_name=${tag_name}" "$@" \
- | _post "/repos/${owner}/${repo}/releases" \
- | _filter_json "${_filter}"
-}
-
-edit_release() {
- # Edit a release
- #
- # https://developer.github.com/v3/repos/releases/#edit-a-release
- #
- # Usage:
- #
- # edit_release org repo 1087855 name='Foo Bar 1.4.6'
- # edit_release user repo 1087855 draft=false
- #
- # Positional arguments
- #
- local owner="${1:?Owner name required.}"
- # A GitHub user or organization.
- local repo="${2:?Repo name required.}"
- # A GitHub repository.
- local release_id="${3:?Release ID required.}"
- # The unique ID of the release; see list_releases.
- #
- # Keyword arguments
- #
- local _filter='"\(.tag_name)\t\(.name)\t\(.html_url)"'
- # A jq filter to apply to the return data.
- #
- # POST data may also be passed as keyword arguments:
- #
- # * `tag_name`
- # * `body`
- # * `draft`
- # * `name`
- # * `prerelease`
- # * `target_commitish`
-
- shift 3
-
- _opts_filter "$@"
-
- _format_json "$@" \
- | _post "/repos/${owner}/${repo}/releases/${release_id}" method="PATCH" \
- | _filter_json "${_filter}"
-}
-
-delete_release() {
- # Delete a release
- #
- # https://developer.github.com/v3/repos/releases/#delete-a-release
- #
- # Usage:
- #
- # delete_release org repo 1087855
- #
- # Return: 0 for success; 1 for failure.
- #
- # Positional arguments
- #
- local owner="${1:?Owner name required.}"
- # A GitHub user or organization.
- local repo="${2:?Repo name required.}"
- # A GitHub repository.
- local release_id="${3:?Release ID required.}"
- # The unique ID of the release; see list_releases.
-
- shift 3
-
- local confirm
-
- _get_confirm 'This will permanently delete a release. Continue?'
- [ "$confirm" -eq 1 ] || exit 0
-
- _delete "/repos/${owner}/${repo}/releases/${release_id}"
- exit $?
-}
-
-release_assets() {
- # List release assets
- #
- # https://developer.github.com/v3/repos/releases/#list-assets-for-a-release
- #
- # Usage:
- #
- # release_assets user repo 1087855
- #
- # Example of downloading release assets:
- #
- # ok.sh release_assets \
- # _filter='.[] | .browser_download_url' \
- # | xargs -L1 curl -L -O
- #
- # Example of the multi-step process for grabbing the release ID for
- # a specific version, then grabbing the release asset IDs, and then
- # downloading all the release assets (whew!):
- #
- # username='myuser'
- # repo='myrepo'
- # release_tag='v1.2.3'
- # ok.sh list_releases "$myuser" "$myrepo" \
- # | awk -F'\t' -v tag="$release_tag" '$2 == tag { print $3 }' \
- # | xargs -I{} ./ok.sh release_assets "$myuser" "$myrepo" {} \
- # _filter='.[] | .browser_download_url' \
- # | xargs -L1 curl -n -L -O
- #
- # Positional arguments
- #
- local owner="${1:?Owner name required.}"
- # A GitHub user or organization.
- local repo="${2:?Repo name required.}"
- # A GitHub repository.
- local release_id="${3:?Release ID required.}"
- # The unique ID of the release; see list_releases.
- #
- # Keyword arguments
- #
- local _filter='.[] | "\(.id)\t\(.name)\t\(.updated_at)"'
- # A jq filter to apply to the return data.
-
- shift 3
-
- _opts_filter "$@"
-
- _get "/repos/${owner}/${repo}/releases/${release_id}/assets" \
- | _filter_json "$_filter"
-}
-
-upload_asset() {
- # Upload a release asset
- #
- # https://developer.github.com/v3/repos/releases/#upload-a-release-asset
- #
- # Usage:
- #
- # upload_asset https:// /path/to/file.zip
- #
- # The upload URL can be gotten from `release()`. There are multiple steps
- # required to upload a file: get the release ID, get the upload URL, parse
- # the upload URL, then finally upload the file. For example:
- #
- # ```sh
- # USER="someuser"
- # REPO="somerepo"
- # TAG="1.2.3"
- # FILE_NAME="foo.zip"
- # FILE_PATH="/path/to/foo.zip"
- #
- # # Create a release then upload a file:
- # ok.sh create_release "$USER" "$REPO" "$TAG" _filter='.upload_url' \
- # | sed 's/{.*$/?name='"$FILE_NAME"'/' \
- # | xargs -I@ ok.sh upload_asset @ "$FILE_PATH"
- #
- # # Find a release by tag then upload a file:
- # ok.sh list_releases "$USER" "$REPO" \
- # | awk -v "tag=$TAG" -F'\t' '$2 == tag { print $3 }' \
- # | xargs -I@ ok.sh release "$USER" "$REPO" @ _filter='.upload_url' \
- # | sed 's/{.*$/?name='"$FILE_NAME"'/' \
- # | xargs -I@ ok.sh upload_asset @ "$FILE_PATH"
- # ```
- #
- # Positional arguments
- #
- local upload_url="${1:?upload_url is required.}"
- # The _parsed_ upload_url returned from GitHub.
- #
- local file_path="${2:?file_path is required.}"
- # A path to the file that should be uploaded.
- #
- # Keyword arguments
- #
- local _filter='"\(.state)\t\(.browser_download_url)"'
- # A jq filter to apply to the return data.
- #
- # Also any other keyword arguments accepted by `_post()`.
-
- shift 2
-
- _opts_filter "$@"
-
- _post "$upload_url" filename="$file_path" "$@" \
- | _filter_json "$_filter"
-}
-
-delete_asset() {
- # Delete a release asset
- #
- # https://docs.github.com/en/rest/reference/releases#delete-a-release-asset
- #
- # Usage:
- #
- # delete_asset user repo 51955388
- #
- # Example of deleting release assets:
- #
- # ok.sh release_assets \
- # _filter='.[] | .id' \
- # | xargs -L1 ./ok.sh delete_asset "$myuser" "$myrepo"
- #
- # Example of the multi-step process for grabbing the release ID for
- # a specific version, then grabbing the release asset IDs, and then
- # deleting all the release assets (whew!):
- #
- # username='myuser'
- # repo='myrepo'
- # release_tag='v1.2.3'
- # ok.sh list_releases "$myuser" "$myrepo" \
- # | awk -F'\t' -v tag="$release_tag" '$2 == tag { print $3 }' \
- # | xargs -I{} ./ok.sh release_assets "$myuser" "$myrepo" {} \
- # _filter='.[] | .id' \
- # | xargs -L1 ./ok.sh -y delete_asset "$myuser" "$myrepo"
- #
- # Positional arguments
- #
- local owner="${1:?Owner name required.}"
- # A GitHub user or organization.
- local repo="${2:?Repo name required.}"
- # A GitHub repository.
- local asset_id="${3:?Release asset ID required.}"
- # The unique ID of the release asset; see release_assets.
-
- shift 3
-
- local confirm
-
- _get_confirm 'This will permanently delete a release asset. Continue?'
- [ "$confirm" -eq 1 ] || exit 0
-
- _delete "/repos/${owner}/${repo}/releases/assets/${asset_id}"
- exit $?
-}
-
-# ### Issues
-# Create, update, edit, delete, list issues and milestones.
-
-list_milestones() {
- # List milestones for a repository
- #
- # Usage:
- #
- # list_milestones someuser/somerepo
- # list_milestones someuser/somerepo state=closed
- #
- # Positional arguments
- #
- local repository="${1:?Repo name required.}"
- # A GitHub repository.
- #
- # Keyword arguments
- #
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.number)\t\(.open_issues)/\(.closed_issues)\t\(.title)"'
- # A jq filter to apply to the return data.
- #
- # GitHub querystring arguments may also be passed as keyword arguments:
- #
- # * `direction`
- # * `per_page`
- # * `sort`
- # * `state`
-
- shift 1
- local qs
-
- _opts_pagination "$@"
- _opts_filter "$@"
- _opts_qs "$@"
-
- _get "/repos/${repository}/milestones${qs}" | _filter_json "$_filter"
-}
-
-create_milestone() {
- # Create a milestone for a repository
- #
- # Usage:
- #
- # create_milestone someuser/somerepo MyMilestone
- #
- # create_milestone someuser/somerepo MyMilestone \
- # due_on=2015-06-16T16:54:00Z \
- # description='Long description here
- # that spans multiple lines.'
- #
- # Positional arguments
- #
- local repo="${1:?Repo name required.}"
- # A GitHub repository.
- local title="${2:?Milestone name required.}"
- # A unique title.
- #
- # Keyword arguments
- #
- local _filter='"\(.number)\t\(.html_url)"'
- # A jq filter to apply to the return data.
- #
- # Milestone options may also be passed as keyword arguments:
- #
- # * `description`
- # * `due_on`
- # * `state`
-
- shift 2
-
- _opts_filter "$@"
-
- _format_json title="$title" "$@" \
- | _post "/repos/${repo}/milestones" \
- | _filter_json "$_filter"
-}
-
-list_issue_comments() {
- # List comments of a specified issue.
- # ( https://developer.github.com/v3/issues/comments/#list-issue-comments )
- #
- # Usage:
- #
- # list_issue_comments someuser/somerepo number
- #
- # Positional arguments
- #
- # GitHub owner login or id for which to list branches
- # Name of the repo for which to list branches
- # Issue number
- #
- local repo="${1:?Repo name required.}"
- local number="${2:?Issue number is required.}"
- shift 2
-
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.body)"'
- # A jq filter to apply to the return data.
-
- _opts_pagination "$@"
-
- # A jq filter to apply to the return data.
- #
- # Querystring arguments may also be passed as keyword arguments:
- #
- # * `direction`
- # * `sort`
- # * `since`
- local qs
- _opts_filter "$@"
- _opts_qs "$@"
- url="/repos/${repo}/issues/${number}/comments"
- _get "${url}${qs}" | _filter_json "${_filter}"
-}
-
-add_comment() {
- # Add a comment to an issue
- #
- # Usage:
- #
- # add_comment someuser/somerepo 123 'This is a comment'
- #
- # Positional arguments
- #
- local repository="${1:?Repo name required}"
- # A GitHub repository
- local number="${2:?Issue number required}"
- # Issue Number
- local comment="${3:?Comment required}"
- # Comment to be added
- #
- # Keyword arguments
- #
- local _filter='"\(.id)\t\(.html_url)"'
- # A jq filter to apply to the return data.
-
- shift 3
- _opts_filter "$@"
-
- _format_json body="$comment" \
- | _post "/repos/${repository}/issues/${number}/comments" \
- | _filter_json "${_filter}"
-}
-
-list_commit_comments() {
- # List comments of a specified commit.
- # ( https://developer.github.com/v3/repos/comments/#list-commit-comments )
- #
- # Usage:
- #
- # list_commit_comments someuser/somerepo sha
- #
- # Positional arguments
- #
- # GitHub owner login or id for which to list branches
- # Name of the repo for which to list branches
- # Commit SHA
- #
- local repo="${1:?Repo name required.}"
- local sha="${2:?Commit SHA is required.}"
- shift 2
-
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.body)"'
- # A jq filter to apply to the return data.
-
- _opts_pagination "$@"
-
- # A jq filter to apply to the return data.
- #
- # Querystring arguments may also be passed as keyword arguments:
- #
- # * `direction`
- # * `sort`
- # * `since`
- local qs
- _opts_filter "$@"
- _opts_qs "$@"
- url="/repos/${repo}/commits/${sha}/comments"
- _get "${url}${qs}" | _filter_json "${_filter}"
-}
-
-
-add_commit_comment() {
- # Add a comment to a commit
- #
- # Usage:
- #
- # add_commit_comment someuser/somerepo 123 'This is a comment'
- #
- # Positional arguments
- #
- local repository="${1:?Repo name required}"
- # A GitHub repository
- local hash="${2:?Commit hash required}"
- # Commit hash
- local comment="${3:?Comment required}"
- # Comment to be added
- #
- # Keyword arguments
- #
- local _filter='"\(.id)\t\(.html_url)"'
- # A jq filter to apply to the return data.
-
- shift 3
- _opts_filter "$@"
-
- _format_json body="$comment" \
- | _post "/repos/${repository}/commits/${hash}/comments" \
- | _filter_json "${_filter}"
-}
-
-close_issue() {
- # Close an issue
- #
- # Usage:
- #
- # close_issue someuser/somerepo 123
- #
- # Positional arguments
- #
- local repository="${1:?Repo name required}"
- # A GitHub repository
- local number="${2:?Issue number required}"
- # Issue Number
- #
- # Keyword arguments
- #
- local _filter='"\(.id)\t\(.state)\t\(.html_url)"'
- # A jq filter to apply to the return data.
- #
- # POST data may also be passed as keyword arguments:
- #
- # * `assignee`
- # * `labels`
- # * `milestone`
-
- shift 2
- _opts_filter "$@"
-
- _format_json state="closed" "$@" \
- | _post "/repos/${repository}/issues/${number}" method='PATCH' \
- | _filter_json "${_filter}"
-}
-
-list_issues() {
- # List issues for the authenticated user or repository
- #
- # Usage:
- #
- # list_issues
- # list_issues someuser/somerepo
- # list_issues state=closed labels=foo,bar
- #
- # Positional arguments
- #
- # user or user/repository
- #
- # Keyword arguments
- #
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.number)\t\(.title)"'
- # A jq filter to apply to the return data.
- #
- # GitHub querystring arguments may also be passed as keyword arguments:
- #
- # * `assignee`
- # * `creator`
- # * `direction`
- # * `labels`
- # * `mentioned`
- # * `milestone`
- # * `per_page`
- # * `since`
- # * `sort`
- # * `state`
-
- local url
- local qs
-
- case $1 in
- ('') url='/user/issues' ;;
- (*=*) url='/user/issues' ;;
- (*/*) url="/repos/${1}/issues"; shift 1 ;;
- esac
-
- _opts_pagination "$@"
- _opts_filter "$@"
- _opts_qs "$@"
-
- _get "${url}${qs}" | _filter_json "$_filter"
-}
-
-user_issues() {
- # List all issues across owned and member repositories for the authenticated user
- #
- # Usage:
- #
- # user_issues
- # user_issues since=2015-60-11T00:09:00Z
- #
- # Keyword arguments
- #
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.repository.full_name)\t\(.number)\t\(.title)"'
- # A jq filter to apply to the return data.
- #
- # GitHub querystring arguments may also be passed as keyword arguments:
- #
- # * `direction`
- # * `filter`
- # * `labels`
- # * `per_page`
- # * `since`
- # * `sort`
- # * `state`
-
- local qs
-
- _opts_pagination "$@"
- _opts_filter "$@"
- _opts_qs "$@"
-
- _get "/issues${qs}" | _filter_json "$_filter"
-}
-
-create_issue() {
- # Create an issue
- #
- # Usage:
- #
- # create_issue owner repo 'Issue title' body='Add multiline body
- # content here' labels="$(./ok.sh _format_json -a foo bar)"
- #
- # Positional arguments
- #
- local owner="${1:?Owner name required.}"
- # A GitHub repository.
- local repo="${2:?Repo name required.}"
- # A GitHub repository.
- local title="${3:?Issue title required.}"
- # A GitHub repository.
- #
- # Keyword arguments
- #
- local _filter='"\(.id)\t\(.number)\t\(.html_url)"'
- # A jq filter to apply to the return data.
- #
- # Additional issue fields may be passed as keyword arguments:
- #
- # * `body` (string)
- # * `assignee` (string)
- # * `milestone` (integer)
- # * `labels` (array of strings)
- # * `assignees` (array of strings)
-
- shift 3
-
- _opts_filter "$@"
-
- _format_json title="$title" "$@" \
- | _post "/repos/${owner}/${repo}/issues" \
- | _filter_json "$_filter"
-}
-
-org_issues() {
- # List all issues for a given organization for the authenticated user
- #
- # Usage:
- #
- # org_issues someorg
- #
- # Positional arguments
- #
- local org="${1:?Organization name required.}"
- # Organization GitHub login or id.
- #
- # Keyword arguments
- #
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.number)\t\(.title)"'
- # A jq filter to apply to the return data.
- #
- # GitHub querystring arguments may also be passed as keyword arguments:
- #
- # * `direction`
- # * `filter`
- # * `labels`
- # * `per_page`
- # * `since`
- # * `sort`
- # * `state`
-
- shift 1
- local qs
-
- _opts_pagination "$@"
- _opts_filter "$@"
- _opts_qs "$@"
-
- _get "/orgs/${org}/issues${qs}" | _filter_json "$_filter"
-}
-
-list_starred() {
- # List starred repositories
- #
- # Usage:
- #
- # list_starred
- # list_starred user
- #
- # Positional arguments
- #
- local user="$1"
- # Optional GitHub user login or id for which to list the starred repos.
- #
- # Keyword arguments
- #
- local _filter='.[] | "\(.name)\t\(.html_url)"'
- # A jq filter to apply to the return data.
- #
- # Querystring arguments may also be passed as keyword arguments:
- #
- # * `direction`
- # * `per_page`
- # * `sort`
- # * `type`
-
- # User is optional; is this a keyword arg?
- case "$user" in *=*) user='' ;; esac
- if [ -n "$user" ]; then shift 1; fi
-
- local qs
-
- _opts_filter "$@"
- _opts_qs "$@"
-
- if [ -n "$user" ] ; then
- url="/users/${user}/starred"
- else
- url='/user/starred'
- fi
-
- _get "${url}${qs}" | _filter_json "${_filter}"
-}
-
-list_my_orgs() {
- # List your organizations
- #
- # Usage:
- #
- # list_my_orgs
- #
- # Keyword arguments
- #
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.login)\t\(.id)"'
- # A jq filter to apply to the return data.
-
- local qs
-
- _opts_pagination "$@"
- _opts_filter "$@"
- _opts_qs "$@"
-
- _get "/user/orgs" | _filter_json "$_filter"
-}
-
-list_orgs() {
- # List all organizations
- #
- # Usage:
- #
- # list_orgs
- #
- # Keyword arguments
- #
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.login)\t\(.id)"'
- # A jq filter to apply to the return data.
-
- local qs
-
- _opts_pagination "$@"
- _opts_filter "$@"
- _opts_qs "$@"
-
- _get "/organizations" | _filter_json "$_filter"
-}
-
-list_users() {
- # List all users
- #
- # Usage:
- #
- # list_users
- #
- # Keyword arguments
- #
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.login)\t\(.id)"'
- # A jq filter to apply to the return data.
-
- local qs
-
- _opts_pagination "$@"
- _opts_filter "$@"
- _opts_qs "$@"
- _get "/users" | _filter_json "$_filter"
-}
-
-labels() {
- # List available labels for a repository
- #
- # Usage:
- #
- # labels someuser/somerepo
- #
- # Positional arguments
- #
- local repo="$1"
- # A GitHub repository.
- #
- # Keyword arguments
- #
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.name)\t\(.color)"'
- # A jq filter to apply to the return data.
-
- _opts_pagination "$@"
- _opts_filter "$@"
-
- _get "/repos/${repo}/labels" | _filter_json "$_filter"
-}
-
-add_label() {
- # Add a label to a repository
- #
- # Usage:
- #
- # add_label someuser/somerepo LabelName color
- #
- # Positional arguments
- #
- local repo="${1:?Repo name required.}"
- # A GitHub repository.
- local label="${2:?Label name required.}"
- # A new label.
- local color="${3:?Hex color required.}"
- # A color, in hex, without the leading `#`.
- #
- # Keyword arguments
- #
- local _filter='"\(.name)\t\(.color)"'
- # A jq filter to apply to the return data.
-
- _opts_filter "$@"
-
- _format_json name="$label" color="$color" \
- | _post "/repos/${repo}/labels" \
- | _filter_json "$_filter"
-}
-
-update_label() {
- # Update a label
- #
- # Usage:
- #
- # update_label someuser/somerepo OldLabelName \
- # label=NewLabel color=newcolor
- #
- # Positional arguments
- #
- local repo="${1:?Repo name required.}"
- # A GitHub repository.
- local label="${2:?Label name required.}"
- # The name of the label which will be updated
- #
- # Keyword arguments
- #
- local _filter='"\(.name)\t\(.color)"'
- # A jq filter to apply to the return data.
- #
- # Label options may also be passed as keyword arguments, these will update
- # the existing values:
- #
- # * `color`
- # * `name`
-
- shift 2
-
- _opts_filter "$@"
-
- _format_json "$@" \
- | _post "/repos/${repo}/labels/${label}" method='PATCH' \
- | _filter_json "$_filter"
-}
-
-add_team_repo() {
- # Add a team repository
- #
- # Usage:
- #
- # add_team_repo team_id organization repository_name permission
- #
- # Positional arguments
- #
- local team_id="${1:?Team id required.}"
- # Team id to add repository to
- local organization="${2:?Organization required.}"
- # Organization to add repository to
- local repository_name="${3:?Repository name required.}"
- # Repository name to add
- local permission="${4:?Permission required.}"
- # Permission to grant: pull, push, admin
- #
- local url="/teams/${team_id}/repos/${organization}/${repository_name}"
-
- export OK_SH_ACCEPT="application/vnd.github.ironman-preview+json"
-
- _format_json "name=${name}" "permission=${permission}" | _post "$url" method='PUT' | _filter_json "${_filter}"
-}
-
-list_pulls() {
- # Lists the pull requests for a repository
- #
- # Usage:
- #
- # list_pulls user repo
- #
- # Positional arguments
- #
- local owner="${1:?Owner required.}"
- # A GitHub owner.
- local repo="${2:?Repo name required.}"
- # A GitHub repository.
- #
- # Keyword arguments
- #
- local _follow_next
- # Automatically look for a 'Links' header and follow any 'next' URLs.
- local _follow_next_limit
- # Maximum number of 'next' URLs to follow before stopping.
- local _filter='.[] | "\(.number)\t\(.user.login)\t\(.head.repo.clone_url)\t\(.head.ref)"'
- # A jq filter to apply to the return data.
-
- _opts_pagination "$@"
- _opts_filter "$@"
-
- _get "/repos/${owner}/${repo}/pulls" | _filter_json "$_filter"
-}
-
-create_pull_request() {
- # Create a pull request for a repository
- #
- # Usage:
- #
- # create_pull_request someuser/somerepo title head base
- #
- # create_pull_request someuser/somerepo title head base body='Description here.'
- #
- # Positional arguments
- #
- local repo="${1:?Repo name required.}"
- # A GitHub repository.
- local title="${2:?Pull request title required.}"
- # A title.
- local head="${3:?Pull request head required.}"
- # A head.
- local base="${4:?Pull request base required.}"
- # A base.
- #
- # Keyword arguments
- #
- local _filter='"\(.number)\t\(.html_url)"'
- # A jq filter to apply to the return data.
- #
- # Pull request options may also be passed as keyword arguments:
- #
- # * `body`
- # * `maintainer_can_modify`
-
- shift 4
-
- _opts_filter "$@"
-
- _format_json title="$title" head="$head" base="$base" "$@" \
- | _post "/repos/${repo}/pulls" \
- | _filter_json "$_filter"
-}
-
-update_pull_request() {
- # Update a pull request for a repository
- #
- # Usage:
- #
- # update_pull_request someuser/somerepo number title='New title' body='New body'
- #
- # Positional arguments
- #
- local repo="${1:?Repo name required.}"
- # A GitHub repository.
- local number="${2:?Pull request number required.}"
- # A pull request number.
- #
- # Keyword arguments
- #
- local _filter='"\(.number)\t\(.html_url)"'
- # A jq filter to apply to the return data.
- #
- # Pull request options may also be passed as keyword arguments:
- #
- # * `base`
- # * `body`
- # * `maintainer_can_modify`
- # * `state` (either open or closed)
- # * `title`
-
- shift 2
-
- _opts_filter "$@"
-
- _format_json "$@" \
- | _post "/repos/${repo}/pulls/${number}" method='PATCH' \
- | _filter_json "$_filter"
-}
-
-transfer_repo() {
- # Transfer a repository to a user or organization
- #
- # Usage:
- #
- # transfer_repo owner repo new_owner
- # transfer_repo owner repo new_owner team_ids='[ 12, 345 ]'
- #
- # Positional arguments
- #
- local owner="${1:?Owner name required.}"
- # Name of the current owner
- #
- local repo="${2:?Repo name required.}"
- # Name of the current repo
- #
- local new_owner="${3:?New owner name required.}"
- # Name of the new owner
- #
- # Keyword arguments
- #
- local _filter='"\(.name)"'
- # A jq filter to apply to the return data.
- #
- # POST data may also be passed as keyword arguments:
- #
- # * `team_ids`
-
- shift 3
-
- _opts_filter "$@"
-
- export OK_SH_ACCEPT='application/vnd.github.nightshade-preview+json'
- _format_json "new_owner=${new_owner}" "$@" | _post "/repos/${owner}/${repo}/transfer" | _filter_json "${_filter}"
-}
-
-archive_repo() {
- # Archive a repo
- #
- # Usage:
- #
- # archive_repo owner/repo
- #
- # Positional arguments
- #
- local repo="${1:?Repo name required.}"
- # A GitHub repository.
- #
- local _filter='"\(.name)\t\(.html_url)"'
- # A jq filter to apply to the return data.
- #
-
- shift 1
-
- _opts_filter "$@"
-
- _format_json "archived=true" \
- | _post "/repos/${repo}" method='PATCH' \
- | _filter_json "$_filter"
-}
-
-__main "$@"
diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml
deleted file mode 100644
index 93fd1983a..000000000
--- a/.github/workflows/ci-build.yml
+++ /dev/null
@@ -1,73 +0,0 @@
-name: Continous integration
-
-on:
- push:
- branches-ignore:
- - 'release*'
- - gh-pages
- pull_request:
- branches-ignore:
- - 'release*'
- - gh-pages
-
-jobs:
- build_linux:
- name: Linux build and test
- runs-on: ubuntu-latest
- strategy:
- matrix:
- java-version: [8, 11]
-
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- with:
- submodules: true
-
- - name: Setup Java ${{ matrix.java-version }}
- uses: actions/setup-java@v4
- with:
- java-version: ${{ matrix.java-version }}
- distribution: 'temurin'
-
- - name: Setup Moxie
- run: |
- wget http://gitblit-org.github.io/moxie/maven/com/gitblit/moxie/moxie+ant/0.10.0/moxie+ant-0.10.0.tar.gz
- tar -xzf moxie+ant-0.10.0.tar.gz
- moxie-0.10.0/bin/moxie -version
-
- - name: Report Java version
- run: |
- java -version
- javac -version
-
- - name: Build with Moxie
- run: moxie-0.10.0/bin/moxie test
-
-
- build_windows:
- name: Windows build and test
- runs-on: windows-latest
- strategy:
- matrix:
- java-version: [8, 11]
-
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- with:
- submodules: true
-
- - name: Setup Java ${{ matrix.java-version }}
- uses: actions/setup-java@v4
- with:
- java-version: ${{ matrix.java-version }}
- distribution: 'temurin'
-
- - name: Report Java version
- run: |
- java -version
- javac -version
-
- - name: Build with Ant
- run: ant test
diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml
deleted file mode 100644
index d8b019562..000000000
--- a/.github/workflows/nightly-build.yml
+++ /dev/null
@@ -1,232 +0,0 @@
-# Nightly build of a snapshot version
-# and a docker image which is pushed
-# to a docker registry
-
-name: Nightly image build and push
-
-on:
- workflow_dispatch:
- inputs:
- forced:
- description: 'Force run, independent of new commits'
- required: false
- default: 'false'
-
- schedule:
- - cron: '33 1 * * *'
-
-
-jobs:
-
-# Check if new commits were added since the last time this workflow ran.
-# The Github cache is used for this, using the SHA as the key.
-
- check_commits:
- name: Check for new commits
- runs-on: ubuntu-latest
- outputs:
- build: ${{ steps.cache-sha.outputs.cache-hit == false }}
-
- steps:
-
- - name: Cache marker for latest commit
- uses: actions/cache@v4
- id: cache-sha
- with:
- key: sha-${{ github.sha }}
- path: timestamp.txt
-
- - name: Register latest commit
- if: ${{ steps.cache-sha.outputs.cache-hit == false }}
- run: |
- echo "Current commit $GITHUB_SHA has no cache hit."
- date > timestamp.txt
- echo "Build job should be triggered now"
- cat timestamp.txt
-
- - name: Stop on no new commit
- if: ${{ steps.cache-sha.outputs.cache-hit }}
- run: |
- echo "Current commit $GITHUB_SHA was already seen."
- echo "Build job should be skipped."
- [ -f timestamp.txt ] && cat timestamp.txt
-
-
-
-# Build Gitblit GO so that it can be packed into a docker image.
-# The built tarball is saved as an artifact, it can be downloaded
-# by interested parties.
-# We could even do better and check if paths of source files changed,
-# but that is not that easy, so we build on any commit.
-
- build:
- name: build GO
- runs-on: ubuntu-latest
- needs: check_commits
- if: ${{ needs.check_commits.outputs.build == 'true' || github.event.inputs.forced == 'true' }}
-
- steps:
-
- - name: Checkout Gitblit
- uses: actions/checkout@v4
- with:
- submodules: true
-
- - name: Setup Java 8
- uses: actions/setup-java@v4
- with:
- java-version: 8
- distribution: 'temurin'
-
- - name: Report Java version
- run: |
- java -version
- javac -version
-
- - name: Build GO with Ant
- run: ant buildGO
-
- - name: Save built Gitblit package
- if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' }}
- uses: actions/upload-artifact@v4
- with:
- name: gitblit-nightly
- path: build/target/gitblit-*-SNAPSHOT.tar.gz
-
-
-
-# This is a gating job, which checks if the secrets necessary for pushing an image
-# to the docker hub are present in the repository. This way this workflow can be
-# present in repos which cannot upload to the docker hub.
-
- secret-gate:
- name: Gate job checking for docker hub secret
- runs-on: ubuntu-latest
- needs: build
- outputs:
- build_docker: ${{steps.check-dh-login.outputs.secrets_present}}
-
- steps:
- - name: Check if we have the necessary data for docker
- id: check-dh-login
- run: |
- if [[ -n "${{secrets.DOCKERHUB_GB_TOKEN}}" && -n "${{secrets.DOCKERHUB_GB_USER}}" ]] ; then
- echo "secrets_present=true" >> $GITHUB_OUTPUT
- else
- echo "No Docker Hub login data found. Skipping Docker."
- fi
-
-
-
-# Only if the gating job signals success will this job run and build and push the docker image
-# built for the current snapshot version of Gitblit.
-
- docker:
- name: Build and push nightly docker image
- runs-on: ubuntu-latest
- if: needs.secret-gate.outputs.build_docker == 'true' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop')
- needs: secret-gate
- env:
- GH_ORG: gitblit-org
- GITBLIT_VERSION: SNAPSHOT
-
- steps:
- - name: Checkout gitblit-docker
- uses: actions/checkout@v4
- with:
- repository: ${{ env.GH_ORG }}/gitblit-docker
- ref: master
- fetch-depth: 2
-
- - name: Download Gitblit nightly build
- uses: actions/download-artifact@v4
- id: get-gb
- with:
- name: gitblit-nightly
-
- - name: Extract snapshot version
- id: gb-version
- run: |
- for file in $(ls -1 ${{steps.get-gb.outputs.download-path}}) ; do
- if [[ "$file" = gitblit-*.gz ]] ; then gbver=$file ; fi
- done
- gbver=${gbver%.tar.gz}
- gbver=${gbver##*gitblit-}
- echo "Version detected: $gbver"
- echo "GITBLIT_VERSION=$gbver" >> "${GITHUB_ENV}"
- echo "gb-version=$gbver" >> $GITHUB_OUTPUT
-
- - name: Generate Dockerfile for snapshot image
- run: |
- generate/generate_dockerfile.sh -v ${{ steps.gb-version.outputs.gb-version }} > generate/Dockerfile
- echo "BUILD_DATE=$(date +%Y-%m-%dT%H:%M:%S)" >> "${GITHUB_ENV}"
-
- - name: Login to Docker Hub
- uses: docker/login-action@v3
- with:
- username: ${{ secrets.DOCKERHUB_GB_USER }}
- password: ${{ secrets.DOCKERHUB_GB_TOKEN }}
-
- - name: Build snapshot docker image
- uses: docker/build-push-action@v6
- with:
- file: generate/Dockerfile
- context: .
- load: true
- tags: gitblit/gitblit:nightly
- labels: |
- org.label-schema.vcs-ref=${{github.sha}}
- org.label-schema.build-date=${{env.BUILD_DATE}}
- org.opencontainers.image.revision=${{ env.GITBLIT_GIT_SHA }}
- org.opencontainers.image.created=${{ env.BUILD_DATE }}
-
- - name: Install Goss for testing the docker image
- uses: e1himself/goss-installation-action@v1.2.1
- with:
- version: 'v0.4.9'
-
- - name: Test docker container - normal mode
- env:
- GOSS_WAIT_OPTS: "-r 15s -s 5s > /dev/null"
- run: |
- dgoss run -e GITBLIT_GOSS_TEST=true -p 8080:8080 -p 8443:8443 gitblit/gitblit:nightly
-
- - name: Test docker container - bind mount
- env:
- GOSS_WAIT_OPTS: "-r 15s -s 5s > /dev/null"
- run: |
- mkdir gitblit-data
- mkdir gitblit-data/etc
- echo "This should not be overwritten" > gitblit-data/etc/gitblit.properties
- echo "include = gitblit-docker.properties" >> gitblit-data/etc/gitblit.properties
- sed -e '/mode: / d' -e '/group: / d' goss.yaml > gitblit-data/goss.yaml
- cp goss_wait.yaml gitblit-data/
- GOSS_FILES_PATH=gitblit-data dgoss run -e GITBLIT_GOSS_TEST=true -p 8080:8080 -p 8443:8443 -v "$PWD/gitblit-data":/var/opt/gitblit gitblit/gitblit:nightly
- [ -d gitblit-data/srv/git ] || exit 1
- [ -f gitblit-data/etc/defaults.properties ] || exit 1
- grep --quiet "This should not be overwritten" gitblit-data/etc/gitblit.properties || exit 1
- sudo rm -rf gitblit-data
-
- - name: Test docker container - tmpfs
- env:
- GOSS_WAIT_OPTS: "-r 15s -s 5s > /dev/null"
- run: |
- dgoss run -e GITBLIT_GOSS_TEST=true -p 8080:8080 -p 8443:8443 --tmpfs /var/opt/gitblit/temp gitblit/gitblit:nightly
-
- # Delete the artifact unless this is the official Gitblit repo
- - uses: geekyeggo/delete-artifact@v5
- if: ${{ github.repository != 'gitblit-org/gitblit' }}
- with:
- name: gitblit-nightly
- failOnError: false
-
- - name: Push docker image to registry
- uses: docker/build-push-action@v6
- with:
- file: generate/Dockerfile
- context: .
- push: true
- tags: gitblit/gitblit:nightly
- labels: |
- org.label-schema.vcs-ref=${{github.sha}}
- org.label-schema.build-date=${{env.BUILD_DATE}}
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index e268ccbc1..000000000
--- a/.gitignore
+++ /dev/null
@@ -1,32 +0,0 @@
-tags
-/temp
-/lib
-/ext
-/build
-/site
-/git
-/lucene
-/build.properties
-/federation.properties
-/mailtest.properties
-/test-users.conf
-/.settings/
-/src/main/java/reference.properties
-/src/main/java/WEB-INF/reference.properties
-/bin/
-/build-demo.xml
-*.directory
-/.gradle
-/pom.xml
-/x509test
-/data
-/*.conf
-/build-next.xml
-/*.ps1
-/*.sh
-/*.factorypath
-/src/main/dagger
-/**/.idea
-/**/init.lua
-/**/session
-/nbproject/private
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 25cab4a1f..000000000
--- a/.gitmodules
+++ /dev/null
@@ -1,6 +0,0 @@
-[submodule "src/main/distrib/data/gitignore"]
- path = src/main/distrib/data/gitignore
- url = https://github.com/github/gitignore.git
-[submodule "src/main/js/prosemirror"]
- path = src/main/js/prosemirror
- url = https://github.com/ProseMirror/prosemirror.git
diff --git a/.mailmap b/.mailmap
deleted file mode 100644
index e47f177f8..000000000
--- a/.mailmap
+++ /dev/null
@@ -1,2 +0,0 @@
-James Moger James Moger
-James Moger James Moger
diff --git a/.project b/.project
deleted file mode 100644
index 90c747bcb..000000000
--- a/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- Gitblit
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- net.sf.eclipsecs.core.CheckstyleBuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- net.sf.eclipsecs.core.CheckstyleNature
-
-
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 63f00a900..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-dist: trusty
-
-language: java
-
-jdk:
- - openjdk8
- - oraclejdk11
diff --git a/src/site/resources/6x12.dfont b/6x12.dfont
similarity index 100%
rename from src/site/resources/6x12.dfont
rename to 6x12.dfont
diff --git a/src/site/resources/6x13.dfont b/6x13.dfont
similarity index 100%
rename from src/site/resources/6x13.dfont
rename to 6x13.dfont
diff --git a/src/site/resources/7x13.dfont b/7x13.dfont
similarity index 100%
rename from src/site/resources/7x13.dfont
rename to 7x13.dfont
diff --git a/src/site/resources/7x14.dfont b/7x14.dfont
similarity index 100%
rename from src/site/resources/7x14.dfont
rename to 7x14.dfont
diff --git a/CNAME b/CNAME
new file mode 100644
index 000000000..306257cca
--- /dev/null
+++ b/CNAME
@@ -0,0 +1 @@
+www.gitblit.com
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index fcfed0285..000000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# How to contribute
-
-Hiii! It is lovely that you are reading this! Since Gitblit has been and still is a labour of love, it can use all the help it can get. It also means that, since this is Open Source and everyone is working on it in their limited free time, to make your contribution count, e.g. get your pull request merged, you should make it easy to review and include your contribution.
-This usually works by spending some of your time and putting some effort into your contribution in order to save others the time, who have to review all the various contributions. It would be such a shame if you created a great feature or fixed a nasty bug but it is not getting included because the maintainers do not find the time to review and test your code because it is too much work.
-
-Speaking of tests, this is certainly an area that is lacking and where help would be very appreciated. Gitblit is currently lacking test coverage, so if you would like to help to speed up development, you could add some unit tests to get more code covered by tests.
-
-Maybe you found a bug. Then it is also great if you just open an issue in the Github issue tracker. But please make sure to include all necessary information that lets others understand what your problem is, what you encountered and actually expected, and (important!) how to reproduce it.
-
-Maybe you found a bug and have already fixed it. Fantastic! Please make sure that you include tests in your pull request for this bug. These tests should demonstrate the bug, i.e. they should fail when run without your fix. They can then be used as regression tests to make sure that the bug does not come back.
-
-The same is true if you added a feature and give us a pull request to get it included. Please make sure that you have covered your feature with tests. And also, update the documentation, or describe it in enough detail in your pull request so that we can update the documentation accordingly.
-
-
-But wait, there are so many ways to contribute!
-
-Maybe you see an existing issue, which you also have with Gitblit, but the existing issue is lacking details. You could triage issues, add steps how to reproduce a bug, provide more insight or even add a unit test which reproduces the bug. Also look out for issues with the label `bug triage`. These are ones we would like to fix but haven't reproduced the problem yet.
-
-Or maybe you think that Gitblit's documentation could be improved. Well, yes, it could. You might have come across something which isn't covered in the documentation or could be clearer. Heck, there are even Github issues concerning documentation. Or you were trying to make sense of Gitblit's code and architecture and started documenting it for your understanding. Whatever it is, if it can help others, too, you could contribute it to the project, share with the community.
-
-Or, browse through open issues and vote for the ones you would like to see fixed or implemeted because you could use it yourself, by leaving a thumbs up feedback.
-
-Or, ....
-
-
-## Pull requests
-
-So, pull requests. Pull requests get reviewed and you can help to make this easy and faster. Which makes us happy and makes you happy. When you create a pull request, pease follow these basic rules:
-
-Every pull request should be from a new, separate branch. Do not create multiple pull requests from the same branch. Do not create a pull request from your `master` branch. This makes it much, much harder to merge them. Why? Because you will keep adding new commits to your `master` branch which have nothing to do with the pull request. But the commits show up in the pull request.
-
-That is why each pull request should have it's own branch, and each branch should have only one topic. That is to say each feature, fix, change set, should be on a separate branch. Maybe we totally love one of your features, but fo some reason will not add a different chnage from you. If both changes were on two branches and therefore two pull requests, the one is easy to merge. If everything is sitting on one branch and in one pull request, then we are left with the work of picking together the commits that we want to merge.
-
-We follow a linear or semi-linear Git history. That means that your pull request should be based on the tip of our `master` (or whatever branch you choose as a target). If it isn't, chances are that we will have to rebase it onto our branch tip. Which takes time, which makes it take longer to merge ....
-
-Tests, did I mention tests? Please remember to include a reasonable amount of test cases.
-
-
-
-In addition to the above, if would be great if you could also keep the following in mind:
-
-
-Provide enough comments in your pull request for others to understand what you changed any why. This helps with the review. Feel free to [reference any issue](https://docs.github.com/en/free-pro-team@latest/github/writing-on-github/autolinked-references-and-urls#issues-and-pull-requests) that is related.
-
-Kindly keep your merge request in a mergeable state. If the checks run on pull requests fail, investigate why and fix it. If the main branch has moved on, it would be tops if you could rebase your changes branch and re-test, so that we don't have to do that.
-
-
-## Commits
-
-Your commits should be atomic, which is to say, put everything that belongs to that change into one commit, but only that and not more than that. The code should compile after each commit. Craft your commits so that they could be reverted individually.
-
-You know that git allows you to clean up your commit history locally, before pushing, so that you can get rid of all the second, third and fourth try to get it right, and it looks like you wrote perfect code the first time around, do you? If you know how, feel free to clean up your branch before pushing it for a pull request.
-
-We also love good commit messages! You may know why you did what you did in your commit, but the rest of the worl doesn't know about your genious, yet. So let us know the Why and What of your change. The How can be found in the code, but all the background is very valuable, too! Feel free to write it into the commit message, share your thoughts with us.
-
-Remember that commit messages are like emails - with a subject line. Did you know that git commit messages are meant to be written like an email, with a subject line? It's true!
-
-Well, others have already written about how to write good commit messages, so let's not repeat it here. If you'd like to know more, you can go and read [Chris' article](https://cbea.ms/git-commit/).
-
-
-## Coding conventions
-
-Gitblit's code has a bit of a mix of styles. It would be easier to digest for everyone and less time-consuming to review and understand, if it would follow a single, common code style. But at least please do not mix different styles in one file. So the first important rule is:
-
-* Keep the style in existing files and use it for code that you add. Do not mix different code styles (braces, naming, casing) in one file.
-
-If you create new files, it would be great if you could adhere to the following for Java code, to establish a common style going forward:
-
-* Indentation is four spaces. No tabs.
-* Sun Java code style
-* A `if`, `while` etc. block with only one statement either uses braces around the statement, or it is all on one line.
-
-This is open source software. Your code will be public and read by many others. Please consider the people who will read your code, and make it look nice and easy to follow for them.
-
-Pleease, do never mix actual functional changes with reformatting or lines with just changed indentation or whitespace in one commit. This makes it very hard to figure out what the actual changes are. Which means it takes longer to review, which means merging the pull request is delayed, .... the lot. If something requires whitespace changes, they should be in their own commit. Mention that in the commit message.
-
-Actually, [do not reformat entire files](https://github.com/rails/rails/pull/13771#issuecomment-32746700).
-
-----
-
-All in all, you should have fun and feel good contributing. So if the above is too much to ask, we would still like your contributions. But it will make it harder for us to include them and thus take a long time and make things slower. These rules are made so that the workload is shared among everyone, since developing software is not only the fun and exciting part but also includes the necessary more mundane tasks.
diff --git a/HOME.md b/HOME.md
deleted file mode 100644
index 89527ee30..000000000
--- a/HOME.md
+++ /dev/null
@@ -1,55 +0,0 @@
-## Documentation
-
-This documentation is the source content from which the [Gitblit website](http://gitblit.com) is generated.
-
-### About Gitblit
-
-[[src/site/features.mkd]]
-[[src/site/design.mkd]]
-[[src/site/faq.mkd]]
-
-### Gitblit GO
-
-[[src/site/setup_go.mkd]]
-[[src/site/upgrade_go.mkd]]
-
-### Gitblit WAR
-
-[[src/site/setup_war.mkd]]
-[[src/site/upgrade_war.mkd]]
-
-### General Configuration & Administration
-
-[[src/site/setup_authentication.mkd]]
-[[src/site/setup_transport_http.mkd]]
-[[src/site/setup_transport_ssh.mkd]]
-[[src/site/setup_clientmenus.mkd]]
-[[src/site/eclipse_plugin.mkd]]
-[[src/site/setup_mirrors.mkd]]
-[[src/site/setup_bugtraq.mkd]]
-[[src/site/setup_hooks.mkd]]
-[[src/site/setup_lucene.mkd]]
-[[src/site/setup_proxy.mkd]]
-[[src/site/setup_viewer.mkd]]
-[[src/site/administration.mkd]]
-[[src/site/setup_scaling.mkd]]
-[[src/site/setup_filestore.mkd]]
-
-
-### Gitblit Tickets
-
-[[src/site/tickets_overview.mkd]]
-[[src/site/tickets_using.mkd]]
-[[src/site/tickets_barnum.mkd]]
-[[src/site/tickets_setup.mkd]]
-[[src/site/tickets_replication.mkd]]
-
-### Gitblit Plugins
-
-[[src/site/plugins_overview.mkd]]
-[[src/site/plugins_extensions.mkd]]
-
-### Other Pages
-
-[[src/site/federation.mkd]]
-[[src/site/rpc.mkd]]
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 753842b67..000000000
--- a/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
\ No newline at end of file
diff --git a/NOTICE b/NOTICE
deleted file mode 100644
index 1ed22a284..000000000
--- a/NOTICE
+++ /dev/null
@@ -1,376 +0,0 @@
-Gitblit
-Copyright 2011 gitblit.com
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-This is an aggregated NOTICE file for the projects included
-in this distribution or linked to by this distribution.
-
----------------------------------------------------------------------------
-Bootstrap
----------------------------------------------------------------------------
- Bootstrap, released under the
- Apache Software License, Version 2.0.
-
- http://twitter.github.com/bootstrap
-
----------------------------------------------------------------------------
-google-code-prettify
----------------------------------------------------------------------------
- google-code-prettify, released under the
- Apache Software License, Version 2.0.
-
- https://github.com/googlearchive/code-prettify
-
----------------------------------------------------------------------------
-Commons Daemon
----------------------------------------------------------------------------
- Commons Daemon, released under the
- Apache Software License, Version 2.0.
-
- http://commons.apache.org/daemon
-
----------------------------------------------------------------------------
-JGit
----------------------------------------------------------------------------
- JGit, released under the
- Eclipse Distribution License 1.0.
-
- http://eclipse.org/jgit
-
----------------------------------------------------------------------------
-Apache Wicket
----------------------------------------------------------------------------
- Apache Wicket, released under the
- Apache Software License, Version 2.0.
-
- http://wicket.apache.org
-
----------------------------------------------------------------------------
-Jetty
----------------------------------------------------------------------------
- Jetty, released under the
- Apache Software License, Version 2.0.
-
- http://eclipse.org/jetty
-
----------------------------------------------------------------------------
-Apache Lucene
----------------------------------------------------------------------------
- Apache Lucene, released under the
- Apache Software License, Version 2.0.
-
- http://lucene.apache.org
-
----------------------------------------------------------------------------
-Groovy
----------------------------------------------------------------------------
- Groovy, released under the
- Apache Software License, Version 2.0.
-
- http://groovy.codehaus.org
-
----------------------------------------------------------------------------
-SLF4J
----------------------------------------------------------------------------
- SLF4J, released under the
- MIT/X11 License.
-
- http://www.slf4j.org
-
----------------------------------------------------------------------------
-Log4j
----------------------------------------------------------------------------
- Log4j, released under the
- Apache Software License, Version 2.0.
-
- http://logging.apache.org/log4j
-
----------------------------------------------------------------------------
-BouncyCastle
----------------------------------------------------------------------------
- BouncyCastle, released under the
- MIT/X11 License.
-
- http://www.bouncycastle.org
-
----------------------------------------------------------------------------
-JSch
----------------------------------------------------------------------------
- JSch - Java Secure Channel, released under the
- BSD License.
-
- http://www.jcraft.com/jsch
-
----------------------------------------------------------------------------
-Rome
----------------------------------------------------------------------------
- Rome RSS and Atom Java Utilities, released under the
- Apache Software License, Version 1.1.
-
- http://rome.dev.java.net
-
----------------------------------------------------------------------------
-jdom
----------------------------------------------------------------------------
- jdom xml library, released under the
- Apache-style Software License.
-
- http://www.jdom.org
-
----------------------------------------------------------------------------
-google-gson
----------------------------------------------------------------------------
- google-gson, released under the
- Apache-style Software License.
-
- https://github.com/google/gson
-
----------------------------------------------------------------------------
-javamail
----------------------------------------------------------------------------
- javamail, released under multiple licenses
- CDDL-1.0, BSD, GPL-2.0, GNU-Classpath.
-
- http://kenai.com/projects/javamail
-
----------------------------------------------------------------------------
-JUnit
----------------------------------------------------------------------------
- JUnit, released under the
- Common Public License.
-
- http://junit.org
-
----------------------------------------------------------------------------
-Fancybox image viewer
----------------------------------------------------------------------------
- Fancybox image viewer, released under the
- MIT and GPL Licenses.
-
- http://fancybox.net
-
----------------------------------------------------------------------------
-FatCow Icons
----------------------------------------------------------------------------
- FatCow Icons, released under the
- Creative Commons CC-BY License.
-
- http://www.fatcow.com/free-icons
-
----------------------------------------------------------------------------
-Git logo
----------------------------------------------------------------------------
- Git logo, released under the
- Creative Commons CC-BY License.
-
- http://henrik.nyh.se/2007/06/alternative-git-logo-and-favicon
-
----------------------------------------------------------------------------
-Git logo
----------------------------------------------------------------------------
- Git logo, released under the
- Creative Commons Attribution 3.0 Unported License.
-
- http://git-scm.com/downloads/logos
-
----------------------------------------------------------------------------
-magnifying glass search icon
----------------------------------------------------------------------------
- magnifying glass search icon, released under the
- Creative Commons CC-BY License.
-
- http://gnome.org
-
----------------------------------------------------------------------------
-GLYHPICONS
----------------------------------------------------------------------------
- GLPYHICONS, released under the
- Creative Commons CC-BY License.
-
- http://glyphicons.com
-
----------------------------------------------------------------------------
-UnboundID
----------------------------------------------------------------------------
- UnboundID, released under the
- GNU LESSER GENERAL PUBLIC LICENSE.
-
- http://www.unboundid.com
-
----------------------------------------------------------------------------
-JCalendar
----------------------------------------------------------------------------
- JCalendar, released under the
- GNU LESSER GENERAL PUBLIC LICENSE.
-
- http://www.toedter.com/en/jcalendar
-
----------------------------------------------------------------------------
-Commons-Compress
----------------------------------------------------------------------------
- Commons-Compress, released under the
- Apache Software License, Version 2.0.
-
- http://commons.apache.org/compress
-
----------------------------------------------------------------------------
-XZ for Java
----------------------------------------------------------------------------
- XZ for Java, released under the
- Public Domain
-
- http://tukaani.org/xz/java.html
-
----------------------------------------------------------------------------
-Iconic
----------------------------------------------------------------------------
- Iconic, release under the
- Creative Commons Share Alike 3.0 License.
-
- http://somerandomdude.com/work/iconic
-
----------------------------------------------------------------------------
-AngularJS
----------------------------------------------------------------------------
- AngularJS, release under the
- MIT License.
-
- http://angularjs.org/
-
----------------------------------------------------------------------------
-FreeMarker
----------------------------------------------------------------------------
- FreeMarker, release under a
- modified BSD License. (http://www.freemarker.org/docs/app_license.html)
-
- http://www.freemarker.org/
-
----------------------------------------------------------------------------
-Waffle
----------------------------------------------------------------------------
- Waffle, release under the
- Eclipse Public License, version 1.0
-
- http://dblock.github.io/waffle
-
----------------------------------------------------------------------------
-JNA
----------------------------------------------------------------------------
- JNA, release under the
- Lesser GNU Public License, version 2.1
-
- https://github.com/twall/jna
-
----------------------------------------------------------------------------
-Guava
----------------------------------------------------------------------------
- Guava, release under the
- Apache License 2.0.
-
- https://code.google.com/p/guava-libraries
-
----------------------------------------------------------------------------
-libpam4j
----------------------------------------------------------------------------
- libpam4j, release under the
- MIT license.
-
- https://github.com/kohsuke/libpam4j
-
----------------------------------------------------------------------------
-commons-codec
----------------------------------------------------------------------------
- commons-codec, release under the
- Apache License 2.0.
-
- http://commons.apache.org/proper/commons-codec
-
----------------------------------------------------------------------------
-pegdown
----------------------------------------------------------------------------
- pegdown, release under the
- Apache License 2.0.
-
- https://github.com/sirthias/pegdown
-
----------------------------------------------------------------------------
-font-awesome
----------------------------------------------------------------------------
- font-awesome, release under the
- SIL OFL 1.1.
-
- https://github.com/FortAwesome/Font-Awesome
-
----------------------------------------------------------------------------
-AUI (excerpts)
----------------------------------------------------------------------------
- AUI, release under the
- Apache License 2.0
-
- https://bitbucket.org/atlassian/aui
-
----------------------------------------------------------------------------
-Jedis
----------------------------------------------------------------------------
- Jedis, release under the
- MIT license
-
- https://github.com/xetorthio/jedis
-
----------------------------------------------------------------------------
-args4j
----------------------------------------------------------------------------
- args4j, release under the
- Apache License 2.0
-
- http://args4j.kohsuke.org
-
----------------------------------------------------------------------------
-jQuery
----------------------------------------------------------------------------
- jQuery, release under the
- MIT License
-
- https://jquery.org
-
----------------------------------------------------------------------------
-flotr2
----------------------------------------------------------------------------
- flotr2, release under the
- BSD License
-
- http://humblesoftware.com/flotr2
-
----------------------------------------------------------------------------
-Mina SSHD
----------------------------------------------------------------------------
- Mina SSHD, release under the
- Apache License 2.0
-
- https://mina.apache.org
-
----------------------------------------------------------------------------
-pf4j
----------------------------------------------------------------------------
- pf4j, release under the
- Apache License 2.0
-
- https://github.com/decebals/pf4j
-
----------------------------------------------------------------------------
-google-guice
----------------------------------------------------------------------------
- google-guice, release under the
- Apache License 2.0
-
- https://github.com/google/guice
-
----------------------------------------------------------------------------
-clipboard.js
----------------------------------------------------------------------------
- clipboard.js, release under the
- MIT License
-
- https://clipboardjs.com
diff --git a/README.markdown b/README.markdown
deleted file mode 100644
index 6a133f637..000000000
--- a/README.markdown
+++ /dev/null
@@ -1,68 +0,0 @@
-Gitblit
-=================
-
-Gitblit is an open source, pure Java Git solution for managing, viewing, and serving [Git](http://git-scm.com) repositories. It can serve repositories over the GIT, HTTP, and SSH transports; it can authenticate against multiple providers; and it allows you to get up-and-running with an attractive, capable Git server in less than 5 minutes.
-
-More information about Gitblit can be found [here](http://gitblit.com).
-
-
-
-
-
-License
--------
-
-Gitblit is distributed under the terms of the [Apache Software Foundation license, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
-The text of the license is included in the file LICENSE in the root of the project.
-
-Java Runtime Requirement
-------------------------------------
-
-Gitblit requires a Java 8 Runtime Environment (JRE) or a Java 8 Development Kit (JDK).
-
-Getting help
-------------
-
-| Source | Location |
-| ------------- |--------------------------------------------------------|
-| Documentation | [Gitblit website](http://gitblit.com) |
-| Forums | [Google Groups](https://groups.google.com/forum/#!forum/gitblit) |
-| Twitter | @gitblit or @jamesmoger |
-
-Contributing
-------------
-
-GitHub pull requests are preferred. Any contributions must be distributed under the terms of the [Apache Software Foundation license, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
-
-Please see the [CONTRIBUTING file](CONTRIBUTING.md) for suggestions and guidelines on contributing to Gitblit. Thank you!
-
-### tl;dr
-1. [Fork](https://github.com/gitblit-org/gitblit/fork) (and then `git clone https://github.com/gitblit-org/gitblit.git`).
-2. Create a branch (`git checkout -b branch_name`).
-3. Commit your changes (`git commit -a`).
-4. Push to the branch (`git push origin branch_name`).
-5. Open a Pull Request.
-
-
-Building Gitblit
-----------------
-
-Gitblit uses submodules.
-Make sure to clone using `--recursive` OR to execute `git submodule update --init --recursive`.
-
-[Eclipse](http://eclipse.org) is recommended for development as the project settings are preconfigured.
-
-1. Import the gitblit project into your Eclipse workspace.
-*There will be lots of build errors.*
-2. Using Ant, execute the `build.xml` script in the project root.
-*This will download all necessary build dependencies and will also generate the Keys class for accessing settings.*
-3. Select your gitblit project root and **Refresh** the project, this should correct all build problems.
-4. Using JUnit, execute the `com.gitblit.tests.GitBlitSuite` test suite.
-*This will clone some repositories from the web and run through the unit tests.*
-5. Execute the *com.gitblit.GitBlitServer* class to start Gitblit GO.
-
-Building Tips & Tricks
-----------------------
-1. If you are running Ant from an ANSI-capable console, consider setting the `MX_COLOR` environment variable before executing Ant.
set MX_COLOR=true
-2. The build script will honor your Maven proxy settings. If you need to fine-tune this, please review the [settings.moxie](http://gitblit-org.github.io/moxie/settings.html) documentation.
-
diff --git a/administration.html b/administration.html
new file mode 100644
index 000000000..3b6536d19
--- /dev/null
+++ b/administration.html
@@ -0,0 +1,296 @@
+
+
+
+
+Gitblit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Repositories can be created, edited, renamed, and deleted through the web UI. They may also be created, edited, and deleted from the command-line using real Git or your favorite file manager and text editor.
All repository settings are stored within the repository .git/config file under the gitblit section.
Repository names must be case-insensitive-unique but are CASE-SENSITIVE ON CASE-SENSITIVE FILESYSTEMS. The name must be composed of letters, digits, or / _ - . ~ +
Whitespace is illegal.
Repositories can be grouped within subfolders. e.g. libraries/mycoollib.git and libraries/myotherlib.git
All repositories created with Gitblit are bare and will automatically have .git appended to the name at creation time, if not already specified.
+
Repository Owner
The Repository Owner has the special permission of being able to edit a repository through the web UI. The Repository Owner is not permitted to rename the repository, delete the repository, or reassign ownership to another user.
+
Access Restrictions and Access Permissions
+
Discrete Permissions (Gitblit v1.2.0+)
Since v1.2.0, Gitblit supports more discrete permissions. While Gitblit does not offer a built-in solution for branch-based permissions like Gitolite, it does allow for the following repository access permissions:
+
+
V (view in web ui, RSS feeds, download zip)
+
R (clone)
+
RW (clone and push)
+
RWC (clone and push with ref creation)
+
RWD (clone and push with ref creation, deletion)
+
RW+ (clone and push with ref creation, deletion, rewind)
+
These permission codes are combined with the repository path to create a user permission:
+
RW:mygroup/myrepo.git
+
NOTE: The following repository permissions are equivalent:
+
+
myrepo.git
+
RW+:myrepo.git
+
This is to preserve backwards-compatibility with Gitblit <= 1.1.0 which granted rewind power to all access-permitted users.
+
Discrete Permissions with Regex Matching (Gitblit v1.2.0+)
Gitblit also supports case-insensitive regex matching for repository permissions. The following permission grants push privileges to all repositories in the mygroup folder.
+
RW:mygroup/.*
+
+
Exclusions
When using regex matching it may also be useful to exclude specific repositories or to exclude regex repository matches. You may specify the X permission for exclusion. The following example grants clone permission to all repositories except the repositories in mygroup. The user/team will have no access whatsoever to these repositories.
+
X:mygroup/.*
+R:.*
+
+
Order is Important
The preceding example should suggest that order of permissions is important with regex matching. Here are the rules for determining the permission that is applied to a repository request:
+
+
If the user is an admin or repository owner, then RW+
+
Else if user has an explicit permission, use that
+
Else check for the first regex match in user permissions
+
Else check for the HIGHEST permission from team memberships
+
+
If the team is an admin team, then RW+
+
Else if a team has an explicit permission, use that
+
Else check for the first regex match in team permissions
+
+
+
No-So-Discrete Permissions (Gitblit <= v1.1.0)
Prior to v1.2.0, Gitblit has two main access permission groupings:
+
+
what you are permitted to do as an anonymous user
+
RW+ for any permitted user
+
+
Committer Verification
You may optionally enable committer verification which requires that each commit be committed by the authenticated user pushing the commits. i.e. If Bob is pushing the commits, Bob must be the committer of those commits.
How is this enforced?
Bob must properly set his user.name and user.email values for the repository to match his Gitblit user account BEFORE committing to his repository.
[user "bob"]
+ displayName = Bob Jones
+ emailAddress = bob@somewhere.com
+
git config user.name bob
+git config user.email bob@somewhere.com
+
The committer email address is required to be identical. Display name or username can be used as the committer name.
All checks are case-insensitive.
What about merges?
You can not use fast-forward merges on your client when using committer verification. You must specify --no-ff to ensure that a merge commit is created with your identity as the committer. Only the first/left parent chain is traversed when verifying commits.
+
Reflog
Gitblit v1.2.1 introduced an incomplete reflog mechanism which was completed in 1.3.0. All pushes to Gitblit are automatically logged on an orphan branch, refs/meta/gitblit/reflog. If this ref exists, the reflog page link will be displayed on the repository pages.
This reflog is similar to, but not the same as, the normal Git reflog. The Gitblit reflog links Gitblit accounts to ref changes and because it is stored on an orphan branch, the reflog is portable by the federation mechanism or by a normal git clone --mirror command.
+
Teams
Teams have assigned users and assigned repositories. A user can be a member of multiple teams and a repository may belong to multiple teams. This allows the administrator to quickly add a user to a team without having to keep track of all the appropriate repositories.
+
Administering Users
All users and permissions are stored in the users.conf file. Your file extension must be .conf in order to use this user service.
The users.conf file uses a Git-style configuration format:
The users.conf file allows flexibility for adding new fields to a UserModel object without imposing the complexity of relying on an embedded SQL database.
+
Usernames
Usernames must be unique and are case-insensitive. Whitespace is illegal.
+
Passwords
User passwords are CASE-SENSITIVE and may be plain, md5, combined-md5 or pbkdf2 formatted (see gitblit.properties -> realm.passwordStorage).
+
User Roles
There are four actual roles in Gitblit:
+
+
#admin, which grants administrative powers to that user for all repositories, users, and teams
+
#notfederated, which prevents an account from being pulled by another Gitblit instance
+
#create, which allows the user the power to create personal repositories
+
#fork, which allows the user to create a personal fork of an existing Gitblit-hosted repository
+
+
Personal Repositories & Forks
Personal Repositories and Forks are related but are controlled individually.
+
Creating a Personal Repository
A user may be granted the power to create personal repositories by specifying the #create role through the web ui or through the RPC mechanism via the Gitblit Manager. Personal repositories are exactly like common/shared repositories except that the owner has a few additional administrative powers for that repository, like rename and delete.
+
Creating a Fork
A user may also be granted the power to fork an existing repository hosted on your Gitblit server to their own personal clone by specifying the #fork role through the web ui or via the Gitblit Manager.
Forks are mostly likely personal repositories or common/shared repositories except for two important differences:
+
+
Forks inherit a view/clone access list from the origin repository. i.e. if Team A has clone access to the origin repository, then by default Team A also has clone access to the fork. This is to facilitate collaboration.
+
Forks are always listed in the fork network, regardless of any access restriction set on the fork. In other words, if you fork RepoA.git to ~me/RepoA.git and then set the access restriction of ~me/RepoA.git to Authenticated View, Clone, & Push your fork will still be listed in the fork network for RepoA.git.
+
If you really must have an invisible fork, the clone it locally, create a new personal repository for your invisible fork, and push it back to that personal repository.
+
+
Offer useful features for serving Git repositories. If feature is complex, refer to #1.
+
All dependencies must be retrievable from a publicly accessible Maven repository. This is to ensure authenticity of dependencies and to automate the setup of developer environments.
+
+
Architecture
+
Bundled Dependencies
The following dependencies are bundled with Gitblit.
Import the gitblit project into your Eclipse workspace. There will be lots of build errors.
+
Using Ant, execute the build.xml script in the project root. This will download all necessary build dependencies and will also generate the Keys class for accessing settings.
+
Select your gitblit project root and Refresh the project, this should correct all build problems.
+
Using JUnit, execute the com.gitblit.tests.GitBlitSuite test suite. This will clone some repositories from the web and run through the unit tests.
+
Execute the com.gitblit.GitBlitServer class to start Gitblit.
+
+
Contributing
Pull requests are preferred. Patches are welcome.
Contributions must be your own original work and must licensed under the Apache License, Version 2.0, the same license used by Gitblit.
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/site/fancybox/blank.gif b/fancybox/blank.gif
similarity index 100%
rename from src/site/fancybox/blank.gif
rename to fancybox/blank.gif
diff --git a/src/site/fancybox/fancy_close.png b/fancybox/fancy_close.png
similarity index 100%
rename from src/site/fancybox/fancy_close.png
rename to fancybox/fancy_close.png
diff --git a/src/site/fancybox/fancy_loading.png b/fancybox/fancy_loading.png
similarity index 100%
rename from src/site/fancybox/fancy_loading.png
rename to fancybox/fancy_loading.png
diff --git a/src/site/fancybox/fancy_nav_left.png b/fancybox/fancy_nav_left.png
similarity index 100%
rename from src/site/fancybox/fancy_nav_left.png
rename to fancybox/fancy_nav_left.png
diff --git a/src/site/fancybox/fancy_nav_right.png b/fancybox/fancy_nav_right.png
similarity index 100%
rename from src/site/fancybox/fancy_nav_right.png
rename to fancybox/fancy_nav_right.png
diff --git a/src/site/fancybox/fancy_shadow_e.png b/fancybox/fancy_shadow_e.png
similarity index 100%
rename from src/site/fancybox/fancy_shadow_e.png
rename to fancybox/fancy_shadow_e.png
diff --git a/src/site/fancybox/fancy_shadow_n.png b/fancybox/fancy_shadow_n.png
similarity index 100%
rename from src/site/fancybox/fancy_shadow_n.png
rename to fancybox/fancy_shadow_n.png
diff --git a/src/site/fancybox/fancy_shadow_ne.png b/fancybox/fancy_shadow_ne.png
similarity index 100%
rename from src/site/fancybox/fancy_shadow_ne.png
rename to fancybox/fancy_shadow_ne.png
diff --git a/src/site/fancybox/fancy_shadow_nw.png b/fancybox/fancy_shadow_nw.png
similarity index 100%
rename from src/site/fancybox/fancy_shadow_nw.png
rename to fancybox/fancy_shadow_nw.png
diff --git a/src/site/fancybox/fancy_shadow_s.png b/fancybox/fancy_shadow_s.png
similarity index 100%
rename from src/site/fancybox/fancy_shadow_s.png
rename to fancybox/fancy_shadow_s.png
diff --git a/src/site/fancybox/fancy_shadow_se.png b/fancybox/fancy_shadow_se.png
similarity index 100%
rename from src/site/fancybox/fancy_shadow_se.png
rename to fancybox/fancy_shadow_se.png
diff --git a/src/site/fancybox/fancy_shadow_sw.png b/fancybox/fancy_shadow_sw.png
similarity index 100%
rename from src/site/fancybox/fancy_shadow_sw.png
rename to fancybox/fancy_shadow_sw.png
diff --git a/src/site/fancybox/fancy_shadow_w.png b/fancybox/fancy_shadow_w.png
similarity index 100%
rename from src/site/fancybox/fancy_shadow_w.png
rename to fancybox/fancy_shadow_w.png
diff --git a/src/site/fancybox/fancy_title_left.png b/fancybox/fancy_title_left.png
similarity index 100%
rename from src/site/fancybox/fancy_title_left.png
rename to fancybox/fancy_title_left.png
diff --git a/src/site/fancybox/fancy_title_main.png b/fancybox/fancy_title_main.png
similarity index 100%
rename from src/site/fancybox/fancy_title_main.png
rename to fancybox/fancy_title_main.png
diff --git a/src/site/fancybox/fancy_title_over.png b/fancybox/fancy_title_over.png
similarity index 100%
rename from src/site/fancybox/fancy_title_over.png
rename to fancybox/fancy_title_over.png
diff --git a/src/site/fancybox/fancy_title_right.png b/fancybox/fancy_title_right.png
similarity index 100%
rename from src/site/fancybox/fancy_title_right.png
rename to fancybox/fancy_title_right.png
diff --git a/src/site/fancybox/fancybox-x.png b/fancybox/fancybox-x.png
similarity index 100%
rename from src/site/fancybox/fancybox-x.png
rename to fancybox/fancybox-x.png
diff --git a/src/site/fancybox/fancybox-y.png b/fancybox/fancybox-y.png
similarity index 100%
rename from src/site/fancybox/fancybox-y.png
rename to fancybox/fancybox-y.png
diff --git a/src/site/fancybox/fancybox.png b/fancybox/fancybox.png
similarity index 100%
rename from src/site/fancybox/fancybox.png
rename to fancybox/fancybox.png
diff --git a/src/site/fancybox/jquery-1.4.3.min.js b/fancybox/jquery-1.4.3.min.js
similarity index 100%
rename from src/site/fancybox/jquery-1.4.3.min.js
rename to fancybox/jquery-1.4.3.min.js
diff --git a/src/site/fancybox/jquery.easing-1.3.pack.js b/fancybox/jquery.easing-1.3.pack.js
similarity index 100%
rename from src/site/fancybox/jquery.easing-1.3.pack.js
rename to fancybox/jquery.easing-1.3.pack.js
diff --git a/src/site/fancybox/jquery.fancybox-1.3.4.css b/fancybox/jquery.fancybox-1.3.4.css
similarity index 100%
rename from src/site/fancybox/jquery.fancybox-1.3.4.css
rename to fancybox/jquery.fancybox-1.3.4.css
diff --git a/src/site/fancybox/jquery.fancybox-1.3.4.js b/fancybox/jquery.fancybox-1.3.4.js
similarity index 100%
rename from src/site/fancybox/jquery.fancybox-1.3.4.js
rename to fancybox/jquery.fancybox-1.3.4.js
diff --git a/src/site/fancybox/jquery.fancybox-1.3.4.pack.js b/fancybox/jquery.fancybox-1.3.4.pack.js
similarity index 100%
rename from src/site/fancybox/jquery.fancybox-1.3.4.pack.js
rename to fancybox/jquery.fancybox-1.3.4.pack.js
diff --git a/src/site/fancybox/jquery.mousewheel-3.0.4.pack.js b/fancybox/jquery.mousewheel-3.0.4.pack.js
similarity index 100%
rename from src/site/fancybox/jquery.mousewheel-3.0.4.pack.js
rename to fancybox/jquery.mousewheel-3.0.4.pack.js
diff --git a/faq.html b/faq.html
new file mode 100644
index 000000000..9ee42994c
--- /dev/null
+++ b/faq.html
@@ -0,0 +1,247 @@
+
+
+
+
+Gitblit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
This is a bug in JGit (issue 704). TLDR: Newer git clients are optimized to send less data on the wire. JGit expects complete data to be sent, but there are scenarios where native git can optimize-out sending objects. By default, JGit requires everything sent be complete and referenceable.
If you experience this, the workaround is to temporarily disable the reachable check for the receive pack, push, and then re-enable the setting.
+
git.checkReferencedObjectsAreReachable = false
+
+
Eclipse/Egit/JGit complains that it "can't open upload pack"?
There are a few ways this can occur:
+
+
Are you running Java 7? Java 7 introduced SNI support for SSL connections and it is enabled by default. Java 7 Security Enhancements To disable SNI alerts, add this line to your eclipse.ini file and restart Eclipse.
-Djsse.enableSNIExtension=false
+
You are using https with a self-signed certificate and you did not configure http.sslVerify=false
+
+
Window->Preferences->Team->Git->Configuration
+
Click the New Entry button
+
+
Key = http.sslVerify
+Value = false
+
+
Gitblit GO's default self-signed certificate is bound to localhost and you are trying to clone/push from a client based on an old version of JGit with a known flaw.
+
The repository is clone-restricted and you don't have access.
+
The repository is clone-restricted and your password changed.
+
A regression in Gitblit. :(
+
+
I can not push using git:// protocol on Windows using native Git
This is a long-standing, known bug in the native Git for Windows implementation.
NOTE: You can not trust the url in the address bar of your browser since your browser may decode it for presentation. When in doubt, View Source of the generated html to confirm the href.
There are two possible workarounds for this issue. In gitblit.properties or web.xml:
+
+
try setting web.mountParameters to false. This changes the url scheme from mounted (*/commit/myrepo.git/abcdef*) to parameterized (*/commit/?r=myrepo.git&h=abcdef*).
+
try changing web.forwardSlashCharacter to an asterisk or a !
+
+
Running Gitblit behind mod_proxy or some other proxy layer
You must ensure that the proxy does not decode and then re-encode request urls with interpretation of forward-slashes (*%2F*). If your proxy layer does re-encode embedded forward-slashes then you may not be able to browse grouped repositories or logs, branches, and tags unless you set web.mountParameters=false.
Tomcat takes the extra precaution of disallowing embedded slashes by default. This breaks Gitblit urls. You have a few options on how to handle this scenario:
+
+
Tweak Tomcat Add -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true to CATALINA_OPTS or to your JVM launch parameters
+
web.mountParameters = false and use non-pretty, parameterized urls
+
web.forwardSlashCharacter = ! which tells Gitblit to use ! instead of /
+
+
UTF-8 Filenames
Tomcat also dislikes urls with non-ASCII characters. If your repositories have non-ASCII filenames you will have to modify your connector properties to allow UTF-8 encoded urls.
It's a phonetic play on bitblt which is an image processing operation meaning bit-block transfer.
+
Why use Gitblit?
It's a small tool that allows you to easily manage shared repositories and doesn't require alot of setup or git kung-foo.
+
Who is the target user for Gitblit?
Small workgroups that require centralized repositories.
Gitblit is not meant to be a social coding resource like Github or Bitbucket with 100s or 1000s of users. Gitblit is designed to fulfill the same function as your centralized Subversion or CVS server.
+
Do I need real Git?
No (mostly). Gitblit is based on JGit which is a pure Java implementation of the Git version control system. Everything you need for Gitblit (except Java) is bundled in the distribution file.
+
mostly
Gitblit has experimental support for Garbage Collection using JGit. I have not used it enough to feel comfortable removing the EXPERIMENTAL label. It may work really well, or it may not. One thing you might consider having native git for is periodic garbage collection - when Gitblit is offline.
+
Can I run Gitblit in conjunction with my existing Git tooling?
Yes.
+
Do I need a JDK or can I use a JRE?
Gitblit will run just fine with a JRE.
+
Does Gitblit use a database to store its data?
No. Gitblit stores its repository configuration information within the .git/config file and its user information in users.conf or whatever filename is configured in gitblit.properties.
+
Can I manually edit users.conf, gitblit.properties, or .git/config?
Yes. You can manually manipulate all of them and (most) changes will be immediately available to Gitblit. Exceptions to this are noted in gitblit.properties.
NOTE: Care must be taken to preserve the relationship between user roles and repository names. Please see the User Roles section of the setup page for details.
+
Can I restrict access to branches or paths within a repository?
No, not yet. Access restrictions apply to the repository as a whole.
Gitblit's simple authentication and authorization mechanism can be used to facilitate one or more of the workflows outlined here.
Should you require more fine-grained access controls you might consider writing a Groovy prereceive script to block updating branch refs based on some permissions file. I would be interested in a generic, re-usable script to include with Gitblit, should someone want to implement it.
Alternatively, you could use gitolite and SSH for your repository access.
+
Can I authenticate users against XYZ?
Yes. The user service is pluggable. You may write your own complete user service by implementing the com.gitblit.IUserService interface. Or you may subclass com.gitblit.GitblitUserService and override just the authentication. Set the fully qualified classname as the realm.userService property.
+
What types of Search does Gitblit support?
As of 0.9.0, Gitblit supports Lucene-based searching.
If Lucene indexing is disabled, Gitblit falls back to brute-force commit-traversal search. Commit-traversal search supports case-insensitive searching of commit message (default), author, and committer.
To search by author or committer use the following syntax in the search box:
+
author: james
+committer: james
+
Alternatively, you could enable the search type dropdown list in your gitblit.properties file.
+
Why did you call the setting federation.N.frequency instead of federation.N.period?!
Yes, yes I know that you are really specifying the period, but Frequency sounds better to me. :)
+
Can Gitblit be translated?
Yes. Most messages are localized to a standard Java properties file.
+
+
Automatic generation of ssl certificate for https communications
+
Integrated GUI tool to facilitate x509 PKI including ssl and client certificate generation, client certificate revocation, and client certificate distribution
+
Single text file for configuring server and gitblit
+
A Windows service installation script and configuration tool
+
+
Limitations
+
+
Built-in access controls are not branch-based, they are repository-based.
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/site/resources/fed_aggregation.png b/fed_aggregation.png
similarity index 100%
rename from src/site/resources/fed_aggregation.png
rename to fed_aggregation.png
diff --git a/src/site/resources/fed_mirror.png b/fed_mirror.png
similarity index 100%
rename from src/site/resources/fed_mirror.png
rename to fed_mirror.png
diff --git a/src/main/resources/federated_16x16.png b/federated_16x16.png
similarity index 100%
rename from src/main/resources/federated_16x16.png
rename to federated_16x16.png
diff --git a/federation.html b/federation.html
new file mode 100644
index 000000000..973da7325
--- /dev/null
+++ b/federation.html
@@ -0,0 +1,344 @@
+
+
+
+
+Gitblit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
A Gitblit federation is a mechanism to clone repositories and keep them in sync from one Gitblit instance to another. Federation can be used to maintain a mirror of your Gitblit instance, to aggregate repositories from developer workstations, or to initially clone groups of repositories to developer workstations. If you are/were a Subversion user you might think of this as svn-sync, but better.
If your Gitblit instance allows federation and it is properly registered with another Gitblit instance, each of the non-excluded repositories of your Gitblit instance can be mirrored, in their entirety, to the pulling Gitblit instance. You may optionally allow pulling of user accounts and backup of server settings.
The federation feature should be considered a security backdoor and enabled or disabled as appropriate for your installation.
Please review all the documentation to understand how it works and its limitations.
+
Important Changes to Note
The Gitblit 0.8.0 federation protocol adds retrieval of teams and referenced push scripts. Older clients will not know to request team or push script information.
The Gitblit 0.7.0 federation protocol is incompatible with the 0.6.0 federation protocol because of a change in the way timestamps are formatted.
Gitblit 0.6.0 uses the default google-gson timestamp serializer which generates locally formatted timestamps. Unfortunately, this creates problems for distributed repositories and distributed developers. Gitblit 0.7.0 corrects this error by serializing dates to the iso8601 standard. As a result 0.7.0 is not compatible with 0.6.0. A partial backwards-compatibility fallback was considered but it would only work one direction and since the federation mechanism is bidirectional it was not implemented.
+
Origin Gitblit Instance Requirements
+
+
git.enableGitServlet must be true, all Git clone and pull requests are handled through Gitblit's JGit servlet
+
federation.passphrase must be non-empty
+
The Gitblit origin instance must be http/https accessible by the pulling Gitblit instance. That may require configuring port-forwarding on your router and/or opening ports on your firewall.
+
+
federation.passphrase
The passphrase is used to generate permission tokens that can be shared with other Gitblit instances.
The passphrase value never needs to be shared, although if you give another Gitblit instance the ALL federation token then your passphrase will be transferred/backed-up along with all other server settings.
This value can be anything you want: an integer, a sentence, an haiku, etc. You should probably keep the passphrase simple and use standard Latin characters to prevent Java properties file encoding errors. The tokens generated from this value are affected by case, so consider this value CASE-SENSITIVE.
The federation feature is completely disabled if your passphrase value is empty.
NOTE: Changing your federation.passphrase will break any registrations you have established with other Gitblit instances.
+
Pulling Gitblit Instance Requirements
+
+
consider setting federation.allowProposals=true to facilitate the registration process from origin Gitblit instances
+
properly registered Gitblit instance including, at a minimum, url, federation token, and update frequency
+
+
Controlling What Gets Pulled
If you want your repositories (and optionally users accounts and settings) to be pulled by another Gitblit instance, you need to register your origin Gitblit instance with a pulling Gitblit instance by providing the url of your Gitblit instance and a federation token.
Gitblit generates the following standard federation tokens:
The ALL token allows another Gitblit instance to pull all your repositories, user accounts, server settings, and referenced push scripts. The USERS_AND_REPOSITORIES token allows another Gitblit instance to pull all your repositories and user accounts. The REPOSITORIES token only allows pulling of the repositories.
Individual Gitblit repository configurations such as description and accessRestriction are always mirrored.
If federation.passphrase has a non-empty value, the federation tokens are displayed in the log file and are visible, to administrators, in the web ui.
The three standard tokens grant access to ALL your non-excluded repositories. However, if you only want to specify different groups of repositories to be federated then you need to define federation sets.
+
Federation Sets
Federation Sets (*federation.sets*) are named groups of repositories. The Federation Sets are defined in gitblit.properties and are available for selection in the repository settings page. You can assign a repository to one or more sets and then distribute the federation token for the set. This allows you to grant federation pull access to a subset of your available repositories. Tokens for federation sets only grant pull access for the member repositories.
+
Federation Proposals (Origin Gitblit Instance)
Once you have properly setup your passphrase and can see your federation tokens, you are ready to share them with a pulling Gitblit instance.
The registration process can be partially automated by sending a federation proposal to the pulling Gitblit instance. To send a proposal:
+
+
Login to your Gitblit instance as an administrator
+
Select and click the propose link for the appropriate token on the federation page
+
Confirm the publicly accessible url of your (origin) Gitblit instance
+
Enter the url of the pulling Gitblit instance you want to federate with
+
Optionally enter a message for the administrators
+
Click propose
+
Not all Gitblit instances accept federation proposals, there is a setting which allows Gitblit to outright reject them. In this case an email or instant message to the administrator of the other Gitblit instance is required. :)
If your proposal is accepted, the proposal is cached to disk on the pulling Gitblit server and, if properly configured, the administrators of that Gitblit server will receive an email notification of your proposal.
Your proposal includes:
+
+
the url of your Gitblit instance
+
the federation token you selected and its type
+
the list of your non-excluded repositories, and their configuration details, that you propose to share
+
Submitting a proposal does not automatically register your server with the pulling Gitblit instance. Registration is a manual process for an administrator.
+
Federation Proposals (Pulling Gitblit Instance)
If your Giblit instance has received a federation proposal, you will be alerted to that information the next time you login to Gitblit as an administrator.
You may view the details of a proposal by scrolling down to the bottom of the repositories page and selecting a proposal. Sample registration settings will be generated for you that you may copy & paste into either your gitblit.properties file or your web.xml file.
+
Excluding Repositories (Origin Gitblit Instance)
You may exclude a repository from being pulled by any federated Gitblit instance by setting its federation strategy to EXCLUDE in the repository's settings page.
+
Excluding Repositories (Pulling Gitblit Instance)
You may exclude repositories to pull in a federation registration. You may exclude all or you may exclude based on a simple fuzzy pattern. Only one wildcard character may be used within each pattern. Patterns are space-separated within the exclude and include fields.
Below the repositories list on the repositories page you will find a section named federation registrations. This section enumerates the other gitblit servers you have configured to periodically pull. The status of the latest pull will be indicated on the left with a colored circle, similar to the status of an executed unit test or Hudson/Jenkins build. You can drill into the details of the registration to view the status of the last pull from each repository available from that origin Gitblit instance. Additionally, you can specify the federation.N.notifyOnError=true flag, to be alerted via email of regressive status changes to individual registrations.
+
Tracking Status (Origin Gitblit Instance)
Origin Gitblit instances can not directly track the success or failure status of Pulling Gitblit instances. However, the Pulling Gitblit instance may elect to send a status acknowledgment (*federation.N.sendStatus=true*) to the origin Gitblit server that indicates the per-repository status of the pull operation. This is the same data that is displayed on the Pulling Gitblit instances ui.
+
How does it work? (Origin Gitblit Instances)
A pulling Gitblit instance will periodically contact your Gitblit instance and will provide the token as proof that you have granted it federation access. Your Gitblit instance will decide, based on the supplied token, if the requested data should be returned to the pulling Gitblit instance. Gitblit data (user accounts, repository metadata, and server settings) are serialized as JSON using google-gson and returned to the pulling Gitblit instance. Standard Git clone and pull operations are used to transfer commits.
The federation process executes using an internal administrator account, $gitblit. All the normal authentication and authorization processes are used for federation requests. For example, Git commands are authenticated as $gitblit / token.
While the $gitblit account has access to all repositories, server settings, and user accounts, it is prohibited from accessing the web ui and it is disabled if federation.passphrase is empty.
+
How does it work? (Pulling Gitblit Instances)
Federated repositories defined in gitblit.properties are checked after Gitblit has been running for 1 minute. The next registration check is scheduled at the completion of the current registration check based on the registration's specified frequency.
+
+
The shortest frequency allowed is every 5 minutes
+
Decimal frequency values are cast to integers
+
Frequency values may be specified in mins, hours, or days
+
Values that can not be parsed default to 60 minutes
+
After a repository has been cloned it is flagged as isFederated (which identifies it as being sourced from another Gitblit instance), isFrozen (which prevents Git pushes to this mirror) and federationStrategy=EXCLUDED (which prevents this repository from being pulled by another federated Gitblit instance).
+
Origin Verification
During a federated pull operation, Gitblit does check that the origin of the local repository starts with the url of the federation registration. If they do not match, the repository is skipped and this is indicated in the log.
+
User Accounts & Teams
By default all user accounts and teams (except the admin account) are automatically pulled when using the ALL token or the USERS_AND_REPOSITORIES token. You may exclude a user account from being pulled by a federated Gitblit instance by checking exclude from federation in the edit user page.
The pulling Gitblit instance will store a registration-specific users.conf file for the pulled user accounts and their repository permissions. This file is stored in the federation.N.folder folder.
If you specify federation.N.mergeAccounts=true, then the user accounts and team definitions from the origin Gitblit instance will be integrated into the users.conf file of your Gitblit instance and allow sign-on of those users.
NOTE: Upgrades from older Gitblit versions will not have the #notfederated role assigned to the admin account. Without that role, your admin account WILL be transferred with an ALL or USERS_AND_REPOSITORIES token. Please consider adding the #notfederated role to your admin account!
+
Server Settings
Server settings are only pulled when using the ALL token.
The pulling Gitblit instance will store a registration-specific gitblit.properties file for all pulled settings. This file is stored in the federation.N.folder folder.
These settings are unused by the pulling Gitblit instance.
+
Push Scripts
Your Groovy push scripts are only pulled when using the ALL token.
The pulling Gitblit instance will retrieve any referenced (i.e. used) push script and store it locally as registration_scriptName.groovy in the federation.N.folder folder.
These scripts are unused by the pulling Gitblit instance.
+
Collisions and Conflict Resolution
Gitblit does not detect conflict and it does not offer conflict resolution of repositories, users, teams, or settings.
If an object exists locally that has the same name as the remote object, it is assumed they are the same and the contents of the remote object are merged into the local object. If you can not guarantee that this is the case, then you should not store any federated repositories directly in git.repositoriesFolder and you should not enable mergeAccounts.
By default, federated repositories can not be pushed to, they are read-only by the isFrozen flag. This flag is ONLY enforced by Gitblit's JGit servlet. If you push to a federated repository after resetting the isFrozen flag or via some other Git access technique then you may break Gitblit's ability to continue pulling from the origin repository. If you are only pushing to a local branch then you might be safe.
+
Federation Pull Registration Keys
+
+
federation.N.url
+
string
+
the url of the origin Gitblit instance (required)
+
+
+
federation.N.token
+
string
+
the token provided by the origin Gitblit instance (required)
+
+
+
federation.N.frequency
+
x [mins/hours/days]
+
the period to wait between pull executions
+
+
+
federation.N.folder
+
string
+
the destination folder, relative to git.repositoriesFolder, for these repositories. default is git.repositoriesFolder
+
+
+
federation.N.bare
+
boolean
+
if true(default), each repository is cloned as a bare repository (i.e. no working folder).
+
+
+
federation.N.mirror
+
boolean
+
if true(default), each repository HEAD is reset to origin/master after each pull. The repository is flagged isFrozen after the initial clone.
If false, each repository HEAD will point to the FETCH_HEAD of the initial clone from the origin until pushed to or otherwise manipulated.
+
+
+
federation.N.mergeAccounts
+
boolean
+
if true, merge the retrieved accounts into the users.conf of this Gitblit instance. default is false
+
+
+
federation.N.sendStatus
+
boolean
+
if true, send the status of the federated pull to the origin Gitblit instance. default is false
+
+
+
federation.N.include
+
string array (space-delimited)
+
list of included repositories (wildcard and fuzzy matching supported)
+
+
+
federation.N.exclude
+
string array (space-delimited)
+
list of excluded repositories (wildcard and fuzzy matching supported)
+
+
+
federation.N.notifyOnError
+
boolean
+
if true, send an email to the administrators on an error. default is false
+
+
+
Example Federation Pull Registrations
These examples would be entered into the gitblit.properties file of the pulling gitblit instance.
+
(Nearly) Perfect Mirror Example
This assumes that the token is the ALL token from the origin gitblit instance.
The repositories, example1_users.conf, example1_gitblit.propertiesn and all example1_scripts.groovy will be put in git.repositoriesFolder and the origin user accounts will be merged into the local user accounts, including passwords and all roles. The Gitblit instance will also send a status acknowledgment to the origin Gitblit instance at the end of the pull operation. The status report will include the state of each repository pull (EXCLUDED, SKIPPED, NOCHANGE, PULLED, MIRRORED). This way the origin Gitblit instance can monitor the health of its mirrors.
This example is considered nearly perfect because while the origin Gitblit's server settings & push scripts are pulled and saved locally, they are not merged with your server settings so its not a true mirror.
This assumes that the token is the REPOSITORIES token from the origin gitblit instance. The repositories will be put in git.repositoriesFolder/example2.
This assumes that the token is the REPOSITORIES token from the origin gitblit instance. The repositories will be put in git.repositoriesFolder/example3.
This assumes that the token is the REPOSITORIES token from the origin gitblit instance. The repositories will be put in git.repositoriesFolder/example4.
Instead of setting up a full-blown pulling Gitblit instance, you can also use the federation client command-line utility. This is a packaged subset of the federation feature in a smaller, simpler command-line only tool.
The federation client relies on many of the same dependencies as Gitblit and will download them on first execution.
+
federation.properties
You may use the federation.properties file to configure one or more Gitblit instances that you want to pull from. This file is a subset of the standard gitblit.properties file.
By default this tool does not daemonize itself; it executes and then quits. This allows you to use the native scheduling feature of your OS. Of course, if you'd rather use Gitblit's scheduler you may use that by specifying the --daemon parameter.
+
http.sslVerify
If you are pulling from a Gitblit with a self-signed SSL certificate you will need to configure Git/JGit to bypass certificate verification. (Git-Config Manual Page)
+ Package repository hosting is graciously provided by Cloudsmith.
+
+
What is Gitblit?
Gitblit is an open-source, pure Java stack for managing, viewing, and serving Git repositories. It's designed primarily as a tool for small workgroups who want to host centralized repositories.
+
GO: Single-Stack Solution
Gitblit GO is an integrated, single-stack solution based on Jetty.
You do not need Apache httpd, Perl, Git, or Gitweb. Should you want to use some or all of those, you still can; Gitblit plays nice with the other kids on the block.
This is what you should download if you want to go from zero to Git in less than 5 mins.
+
WAR: For Your Servlet Container
Gitblit WAR is what you should download if you already have a servlet container available that you wish to use. Jetty 6/7/8 and Tomcat 6/7 are known to work. Generally, any Servlet 2.5 or Servlet 3.0 container should work.
+
You decide how to use Gitblit
Gitblit can be used as a dumb repository viewer with no administrative controls or user accounts. Gitblit can be used as a complete Git stack for cloning, pushing, and repository access control. Gitblit can be used without any other Git tooling (including actual Git) or it can cooperate with your established tools.
+
All Transports
The SSH, HTTP, & GIT protocols are supported and ready-to-go out of the box.
+
Issue tracking with branch-based pull requests
Gitblit blends elements of GitHub, BitBucket, and Gerrit to provide a streamlined collaboration workflow based on branches within the primary repository.
+
Easy Remote Management
Administrators can create and manage all repositories, user accounts, and teams from the Web UI. Administrators can create and manage all repositories, user accounts, and teams from the JSON RPC interface using the Gitblit Manager or your own custom tooling. Administrators can create and manage all repositories, user accounts, and teams from the command-line using SSH & the Powertools plugin.
+
Integration with Your Infrastructure
+
+
Extendable by plugins
+
Groovy push hook scripts
+
Pluggable user service mechanism
+
+
LDAP authentication with optional LDAP-controlled Team memberships
+
Redmine authentication
+
SalesForce.com authentication
+
Windows authentication
+
PAM authentication
+
Custom authentication, authorization, and user management
+
+
Rich RSS feeds
+
JSON-based RPC mechanism
+
Java Client RSS/JSON API library for custom integration
+
+
Backup Strategy
Gitblit includes a backup mechanism (*federation*) which can be used to backup repositories and, optionally, user accounts, team definitions, server settings, & Groovy push hook scripts from your Gitblit instance to another Gitblit instance or to a Gitblit Federation Client. Similarly, you can use the federation mechanism to aggregate individual workspace Gitblit instances to a common, centralized server.
+
Java Runtime Requirement
Gitblit requires a Java 8 Runtime Environment (JRE) or a Java 8 Development Kit (JDK).
+
+
+
NOTE: Gitblit does not yet offer a comprehensize dependency injection architecture. This will be addressed in a subsequent release. For now you may access all of Gitblit's core managers through a static singleton app context:
Gitblit supports extending and enhancing the core functionality through plugins. This mechanism is very young and incomplete with few extension points, but you can expect it to evolve rapidly in upcoming releases.
+
What is a plugin?
A plugin is a collection of Java classes and required jar dependencies bundled together in a zip file. A plugin may optionally include Extensions which enhance Gitblit at specific Gitblit-specified ExtensionPoints.
Plugins are singleton instances that are STARTED when Gitblit launches and STOPPED when Gitblit terminates. Extensions are dynamic instances that are created when Gitblit processes requests that trigger ExtensionPoints.
+
Architecture
The existing plugin mechanism is based on pf4j. Plugins are distributed as zip files and may include their runtime dependencies or may rely on the bundled dependencies of other plugins and/or Gitblit core.
The plugin zip files are stored in ${baseFolder}/plugins and are unpacked on startup into folders of the same name.
A plugin defines it's metadata in the META-INF/MANIFEST.MF file:
+
Plugin-Id: powertools
+Plugin-Description: Command and control Gitblit over SSH
+Plugin-Class: com.gitblit.plugin.powertools.Plugin
+Plugin-Version: 1.2.0
+Plugin-Requires: 1.5.0
+Plugin-Provider: gitblit.com
+
In addition to extending Gitblit core, plugins can also define extension points that may be implemented by other plugins. Therefore a plugin may depend on other plugins.
+
Plugin-Dependencies: foo, bar
+
NOTE: The pf4j plugin framework relies on a javac apt processor to generate compile-time extension information, so be sure to enable apt processing in your build process.
+
Limitations of Plugin Dependencies
Plugins may specify plugin dependencies by their ID, but they may not specify dependency versions.
+
Managing Plugins
Administrators may manage plugins through the plugin SSH dispatch command:
+
ssh host -l username -p 29418 plugin
+
Through this command interface plugins can be started, stopped, disabled, enabled, installed, uninstalled, listed, etc. Each command is supports the --help argument which will guide you in understanding the options and usage of the command.
You may watch an Asciinema screencast of how to use the SSH transport and the plugin manager here.
+
Default Plugin Registry
Gitblit provides a simple default registry of plugins. The registry is a JSON file and it lists plugin metadata and download locations.
If you develop your own plugins that you want hosted by or linked in the default registry, open a pull request for the registry repository. Any contributed binaries hosted in this repository must have Maven metadata and the SHA-1 & MD5 checksums. By default, Gitblit enforces checksum validation on all downloads.
+
Hosting your Own Registry / Allowing Multiple Registries
The plugins.json file is parameterized with the ${self} placeholder. This parameter is substituted on download with with the source URL of the registry file. This allows you to clone and serve your own copy of this git repository or just serve your own plugins.json on your own network.
Gitblit also supports loading multiple plugin registries. Just place another properly formatted.json file in ${baseFolder}/plugins and Gitblit will load that as an additional registry.
+
+
#
+# DEFAULTS.PROPERTIES
+#
+# The default Gitblit settings.
+#
+
+# This settings file supports parameterization from the command-line for the
+# following command-line parameters:
+#
+# --baseFolder ${baseFolder} SINCE 1.2.1
+#
+# Settings that support ${baseFolder} parameter substitution are indicated with the
+# BASEFOLDER attribute. If the --baseFolder argument is unspecified, ${baseFolder}
+# and it's trailing / will be discarded from the setting value leaving a relative
+# path that is equivalent to pre-1.2.1 releases.
+#
+# e.g. "${baseFolder}/git" becomes "git", if --baseFolder is unspecified
+#
+# Git Servlet Settings
+#
+
+# Base folder for repositories.
+# This folder may contain bare and non-bare repositories but Gitblit will only
+# allow you to push to bare repositories.
+# Use forward slashes even on Windows!!
+# e.g. c:/gitrepos
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+# BASEFOLDER
+git.repositoriesFolder = ${baseFolder}/git
+
+# Build the available repository list at startup and cache this list for reuse.
+# This reduces disk io when presenting the repositories page, responding to rpcs,
+# etc, but it means that Gitblit will not automatically identify repositories
+# added or deleted by external tools.
+#
+# For this case you can use curl, wget, etc to issue an rpc request to clear the
+# cache (e.g. https://localhost/rpc?req=CLEAR_REPOSITORY_CACHE)
+#
+# SINCE 1.1.0
+git.cacheRepositoryList = true
+
+# Search the repositories folder subfolders for other repositories.
+# Repositories MAY NOT be nested (i.e. one repository within another)
+# but they may be grouped together in subfolders.
+# e.g. c:/gitrepos/libraries/mylibrary.git
+# c:/gitrepos/libraries/myotherlibrary.git
+#
+# SINCE 0.5.0
+git.searchRepositoriesSubfolders = true
+
+# Maximum number of folders to recurse into when searching for repositories.
+# The default value, -1, disables depth limits.
+#
+# SINCE 1.1.0
+git.searchRecursionDepth = -1
+
+# List of regex exclusion patterns to match against folders found in
+# git.repositoriesFolder.
+# Use forward slashes even on Windows!!
+# e.g. test/jgit.git
+#
+# SPACE-DELIMITED
+# CASE-SENSITIVE
+# SINCE 1.1.0
+git.searchExclusions =
+
+# List of regex url patterns for extracting a repository name when locating
+# submodules.
+# e.g. git.submoduleUrlPatterns = .*?://github.com/(.*) will extract
+# gitblit-org/gitblit.git from *git://github.com/gitblit-org/gitblit.git*
+# If no matches are found then the submodule repository name is assumed to be
+# whatever trails the last / character. (e.g. gitblit.git).
+#
+# SPACE-DELIMITED
+# CASE-SENSITIVE
+# SINCE 1.1.0
+git.submoduleUrlPatterns = .*?://github.com/(.*)
+
+# Specify the interface for Git Daemon to bind it's service.
+# You may specify an ip or an empty value to bind to all interfaces.
+# Specifying localhost will result in Gitblit ONLY listening to requests to
+# localhost.
+#
+# SINCE 1.3.0
+# RESTART REQUIRED
+git.daemonBindInterface =
+
+# port for serving the Git Daemon service. <= 0 disables this service.
+# On Unix/Linux systems, ports < 1024 require root permissions.
+# Recommended value: 9418
+#
+# SINCE 1.3.0
+# RESTART REQUIRED
+git.daemonPort = 9418
+
+# The port for serving the SSH service. <= 0 disables this service.
+# On Unix/Linux systems, ports < 1024 require root permissions.
+# Recommended value: 29418
+#
+# SINCE 1.5.0
+# RESTART REQUIRED
+git.sshPort = 29418
+
+# Specify the interface for the SSH daemon to bind its service.
+# You may specify an ip or an empty value to bind to all interfaces.
+# Specifying localhost will result in Gitblit ONLY listening to requests to
+# localhost.
+#
+# SINCE 1.5.0
+# RESTART REQUIRED
+git.sshBindInterface =
+
+# Manually specify the hostname to use in advertised SSH repository urls.
+# This may be useful in complex forwarding setups.
+#
+# SINCE 1.7.0
+git.sshAdvertisedHost =
+
+# Manually specify the port to use in advertised SSH repository urls.
+# This may be useful in complex forwarding setups.
+#
+# SINCE 1.7.0
+git.sshAdvertisedPort =
+
+# Specify the SSH key manager to use for retrieving, storing, and removing
+# SSH keys.
+#
+# Valid key managers are:
+# com.gitblit.transport.ssh.FileKeyManager
+#
+# SINCE 1.5.0
+git.sshKeysManager = com.gitblit.transport.ssh.FileKeyManager
+
+# Directory for storing user SSH keys when using the FileKeyManager.
+#
+# SINCE 1.5.0
+git.sshKeysFolder = ${baseFolder}/ssh
+
+
+# Authentication methods offered by the SSH server.
+# Space separated list of authentication method names that the
+# server shall offer. The default is "publickey password".
+#
+# Valid authentication method names are:
+# publickey - authenticate with SSH public key
+# password - authenticate with username, password
+# keyboard-interactive - currently synonym to 'password'
+# gssapi-with-mic - GSS API Kerberos 5 authentication
+#
+# This setting obsoletes the "git.sshWithKrb5" setting. To enable
+# Kerberos5 (GSS) authentication, add 'gssapi-with-mic' to the list.
+#
+# SINCE 1.9.0
+# RESTART REQUIRED
+# SPACE-DELIMITED
+git.sshAuthenticationMethods = publickey password
+
+
+# The path to a Kerberos 5 keytab.
+#
+# SINCE 1.7.0
+git.sshKrb5Keytab =
+
+# The service principal name to be used for Kerberos5.
+# The default is host/hostname.
+#
+# SINCE 1.7.0
+git.sshKrb5ServicePrincipalName =
+
+# Strip the domain suffix from a kerberos username.
+# e.g. james@bigbox would be "james"
+#
+# SINCE 1.7.0
+git.sshKrb5StripDomain = true
+
+# SSH backend NIO2|MINA.
+#
+# The Apache Mina project recommends using the NIO2 backend.
+#
+# SINCE 1.5.0
+git.sshBackend = NIO2
+
+# Number of threads used to parse a command line submitted by a client over SSH
+# for execution, create the internal data structures used by that command,
+# and schedule it for execution on another thread.
+#
+# SINCE 1.5.0
+git.sshCommandStartThreads = 2
+
+
+# Allow push/pull over http/https with JGit servlet.
+# If you do NOT want to allow Git clients to clone/push to Gitblit set this
+# to false. You might want to do this if you are only using ssh:// or git://.
+# If you set this false, consider changing the web.otherUrls setting to
+# indicate your clone/push urls.
+#
+# SINCE 0.5.0
+git.enableGitServlet = true
+
+# If you want to restrict all git servlet access to those with valid X509 client
+# certificates then set this value to true.
+#
+# SINCE 1.2.0
+git.requiresClientCertificate = false
+
+# Enforce date checks on client certificates to ensure that they are not being
+# used prematurely and that they have not expired.
+#
+# SINCE 1.2.0
+git.enforceCertificateValidity = true
+
+# List of OIDs to extract from a client certificate DN to map a certificate to
+# an account username.
+#
+# e.g. git.certificateUsernameOIDs = CN
+# e.g. git.certificateUsernameOIDs = FirstName LastName
+#
+# SPACE-DELIMITED
+# SINCE 1.2.0
+git.certificateUsernameOIDs = CN
+
+# Only serve/display bare repositories.
+# If there are non-bare repositories in git.repositoriesFolder and this setting
+# is true, they will be excluded from the ui.
+#
+# SINCE 0.9.0
+git.onlyAccessBareRepositories = false
+
+
+# Specify the list of acceptable transports for pushes.
+# If this setting is empty, all transports are acceptable.
+#
+# Valid choices are: GIT HTTP HTTPS SSH
+#
+# SINCE 1.5.0
+# SPACE-DELIMITED
+git.acceptedPushTransports = HTTP HTTPS SSH
+
+# Allow an authenticated user to create a destination repository on a push if
+# the repository does not already exist.
+#
+# Administrator accounts can create a repository in any project.
+# These repositories are created with the default access restriction and authorization
+# control values. The pushing account is set as the owner.
+#
+# Non-administrator accounts with the CREATE role may create personal repositories.
+# These repositories are created as VIEW restricted for NAMED users.
+# The pushing account is set as the owner.
+#
+# SINCE 1.2.0
+git.allowCreateOnPush = true
+
+# Global setting to control anonymous pushes.
+#
+# This setting allows/rejects anonymous pushes at the level of the receive pack.
+# This trumps all repository config settings. While anonymous pushes are convenient
+# on your own box when you are a lone developer, they are not recommended for
+# any multi-user installation where accountability is required. Since Gitblit
+# tracks pushes and user accounts, allowing anonymous pushes compromises that
+# information.
+#
+# SINCE 1.4.0
+git.allowAnonymousPushes = false
+
+# The default access restriction for new repositories.
+# Valid values are NONE, PUSH, CLONE, VIEW
+# NONE = anonymous view, clone, & push
+# PUSH = anonymous view & clone and authenticated push
+# CLONE = anonymous view, authenticated clone & push
+# VIEW = authenticated view, clone, & push
+#
+# SINCE 1.0.0
+git.defaultAccessRestriction = PUSH
+
+# The default authorization control for new repositories.
+# Valid values are AUTHENTICATED and NAMED
+# AUTHENTICATED = any authenticated user is granted restricted access
+# NAMED = only named users/teams are granted restricted access
+#
+# SINCE 1.1.0
+git.defaultAuthorizationControl = NAMED
+
+# The prefix for a users personal repository directory.
+#
+# Personal user repositories are created in this directory, named by the user name
+# prefixed with the userRepositoryPrefix. For eaxmple, a user 'john' would have his
+# personal repositories in the directory '~john'.
+#
+# Cannot be an empty string. Also, absolute paths are changed to relative paths by
+# removing the first directory separator.
+#
+# It is not recommended to change this value AFTER your user's have created
+# personal repositories because it will break all permissions, ownership, and
+# repository push/pull operations.
+#
+# RESTART REQUIRED
+# SINCE 1.4.0
+git.userRepositoryPrefix = ~
+
+# The default incremental push tag prefix. Tag prefix applied to a repository
+# that has automatic push tags enabled and does not specify a custom tag prefix.
+#
+# If incremental push tags are enabled, the tips of each branch in the push will
+# be tagged with an increasing revision integer.
+#
+# e.g. refs/tags/r2345 or refs/tags/rev_2345
+#
+# SINCE 1.3.0
+git.defaultIncrementalPushTagPrefix = r
+
+# Controls creating a repository as --shared on Unix servers.
+#
+# In an Unix environment where mixed access methods exist for shared repositories,
+# the repository should be created with 'git init --shared' to make sure that
+# it can be accessed e.g. via ssh (user git) and http (user www-data).
+#
+# Valid values are the values available for the '--shared' option. See the manual
+# page for 'git init' for more information on shared repositories.
+#
+# SINCE 1.4.0
+git.createRepositoriesShared = false
+
+# Directory for gitignore templates used during repository creation.
+#
+# SINCE 1.6.0
+git.gitignoreFolder = ${baseFolder}/gitignore
+
+# Enable JGit-based garbage collection. (!!EXPERIMENTAL!!)
+#
+# USE AT YOUR OWN RISK!
+#
+# If enabled, the garbage collection executor scans all repositories once a day
+# at the hour of your choosing. The GC executor will take each repository "offline",
+# one-at-a-time, to check if the repository satisfies it's GC trigger requirements.
+#
+# While the repository is offline it will be inaccessible from the web UI or from
+# any of the other services (git, rpc, rss, etc).
+#
+# Gitblit's GC Executor MAY NOT PLAY NICE with the other Git kids on the block,
+# especially on Windows systems, so if you are using other tools please coordinate
+# their usage with your GC Executor schedule or do not use this feature.
+#
+# The GC algorithm complex and the JGit team advises caution when using their
+# young implementation of GC.
+#
+# http://wiki.eclipse.org/EGit/New_and_Noteworthy/2.1#Garbage_Collector_and_Repository_Storage_Statistics
+#
+# EXPERIMENTAL
+# SINCE 1.2.0
+# RESTART REQUIRED
+git.enableGarbageCollection = false
+
+# Hour of the day for the GC Executor to scan repositories.
+# This value is in 24-hour time.
+#
+# SINCE 1.2.0
+git.garbageCollectionHour = 0
+
+# The default minimum total filesize of loose objects to trigger early garbage
+# collection.
+#
+# You may specify a custom threshold for a repository in the repository's settings.
+# Common unit suffixes of k, m, or g are supported.
+#
+# SINCE 1.2.0
+git.defaultGarbageCollectionThreshold = 500k
+
+# The default period, in days, between GCs for a repository. If the total filesize
+# of the loose object exceeds git.garbageCollectionThreshold or the repository's
+# custom threshold, this period will be short-circuited.
+#
+# e.g. if a repository collects 100KB of loose objects every day with a 500KB
+# threshold and a period of 7 days, it will take 5 days for the loose objects to
+# be collected, packed, and pruned.
+#
+# OR
+#
+# if a repository collects 10KB of loose objects every day with a 500KB threshold
+# and a period of 7 days, it will take the full 7 days for the loose objects to be
+# collected, packed, and pruned.
+#
+# You may specify a custom period for a repository in the repository's settings.
+#
+# The minimum value is 1 day since the GC Executor only runs once a day.
+#
+# SINCE 1.2.0
+git.defaultGarbageCollectionPeriod = 7
+
+# Gitblit can automatically fetch ref updates for a properly configured mirror
+# repository.
+#
+# Requirements:
+#
+
you must manually clone the repository using native git
the "origin" repository must be accessible without authentication OR the
+
+# credentials must be embedded in the origin url (not recommended)
+#
+# Notes:
+#
+
"origin" SSH urls are untested and not likely to work
+
+#
+
mirrors cloned while Gitblit is running are likely to require clearing the
+
+# gitblit cache (link on the repositories page of an administrator account)
+#
+
Gitblit will automatically repair any invalid fetch refspecs with a "//"
+
+# sequence.
+#
+# SINCE 1.4.0
+# RESTART REQUIRED
+git.enableMirroring = false
+
+# Specify the period between update checks for mirrored repositories.
+# The shortest period you may specify between mirror update checks is 5 mins.
+#
+# SINCE 1.4.0
+# RESTART REQUIRED
+git.mirrorPeriod = 30 mins
+
+# Number of bytes of a pack file to load into memory in a single read operation.
+# This is the "page size" of the JGit buffer cache, used for all pack access
+# operations. All disk IO occurs as single window reads. Setting this too large
+# may cause the process to load more data than is required; setting this too small
+# may increase the frequency of read() system calls.
+#
+# Default on JGit is 8 KiB on all platforms.
+#
+# Common unit suffixes of k, m, or g are supported.
+# Documentation courtesy of the Gerrit project.
+#
+# SINCE 1.0.0
+# RESTART REQUIRED
+git.packedGitWindowSize = 8k
+
+# Maximum number of bytes to load and cache in memory from pack files. If JGit
+# needs to access more than this many bytes it will unload less frequently used
+# windows to reclaim memory space within the process. As this buffer must be shared
+# with the rest of the JVM heap, it should be a fraction of the total memory available.
+#
+# The JGit team recommends setting this value larger than the size of your biggest
+# repository. This ensures you can serve most requests from memory.
+#
+# Default on JGit is 10 MiB on all platforms.
+#
+# Common unit suffixes of k, m, or g are supported.
+# Documentation courtesy of the Gerrit project.
+#
+# SINCE 1.0.0
+# RESTART REQUIRED
+git.packedGitLimit = 10m
+
+# Maximum number of bytes to reserve for caching base objects that multiple deltafied
+# objects reference. By storing the entire decompressed base object in a cache Git
+# is able to avoid unpacking and decompressing frequently used base objects multiple times.
+#
+# Default on JGit is 10 MiB on all platforms. You probably do not need to adjust
+# this value.
+#
+# Common unit suffixes of k, m, or g are supported.
+# Documentation courtesy of the Gerrit project.
+#
+# SINCE 1.0.0
+# RESTART REQUIRED
+git.deltaBaseCacheLimit = 10m
+
+# Maximum number of pack files to have open at once. A pack file must be opened
+# in order for any of its data to be available in a cached window.
+#
+# If you increase this to a larger setting you may need to also adjust the ulimit
+# on file descriptors for the host JVM, as Gitblit needs additional file descriptors
+# available for network sockets and other repository data manipulation.
+#
+# Default on JGit is 128 file descriptors on all platforms.
+# Documentation courtesy of the Gerrit project.
+#
+# SINCE 1.0.0
+# RESTART REQUIRED
+git.packedGitOpenFiles = 128
+
+# When true, JGit will use mmap() rather than malloc()+read() to load data from
+# pack files. The use of mmap can be problematic on some JVMs as the garbage
+# collector must deduce that a memory mapped segment is no longer in use before
+# a call to munmap() can be made by the JVM native code.
+#
+# In server applications (such as Gitblit) that need to access many pack files,
+# setting this to true risks artificially running out of virtual address space,
+# as the garbage collector cannot reclaim unused mapped spaces fast enough.
+#
+# Default on JGit is false. Although potentially slower, it yields much more
+# predictable behavior.
+# Documentation courtesy of the Gerrit project.
+#
+# SINCE 1.0.0
+# RESTART REQUIRED
+git.packedGitMmap = false
+
+# Validate all received (pushed) objects are valid.
+#
+# SINCE 1.5.0
+git.checkReceivedObjects = true
+
+# Validate all referenced but not supplied objects are reachable.
+#
+# If enabled, Gitblit will verify that references to objects not contained
+# within the received pack are already reachable through at least one other
+# reference advertised to clients.
+#
+# This feature is useful when Gitblit doesn't trust the client to not provide a
+# forged SHA-1 reference to an object, in an attempt to access parts of the DAG
+# that they aren't allowed to see and which have been hidden from them via the
+# configured AdvertiseRefsHook or RefFilter.
+#
+# Enabling this feature may imply at least some, if not all, of the same functionality
+# performed by git.checkReceivedObjects.
+#
+# SINCE 1.5.0
+git.checkReferencedObjectsAreReachable = true
+
+# Set the maximum allowed Git object size.
+#
+# If an object is larger than the given size the pack-parsing will throw an exception
+# aborting the receive-pack operation. The default value, 0, disables maximum
+# object size checking.
+#
+# SINCE 1.5.0
+git.maxObjectSizeLimit = 0
+
+# Set the maximum allowed pack size.
+#
+# A pack exceeding this size will be rejected. The default value, -1, disables
+# maximum pack size checking.
+#
+# SINCE 1.5.0
+git.maxPackSizeLimit = -1
+
+# Use the Gitblit patch receive pack for processing contributions and tickets.
+# This allows the user to push a patch using the familiar Gerrit syntax:
+#
+# git push HEAD:refs/for/
+#
+# NOTE:
+# This requires git.enableGitServlet = true AND it requires an authenticated
+# git transport connection (http/https) when pushing from a client.
+#
+# Valid services include:
+# com.gitblit.tickets.FileTicketService
+# com.gitblit.tickets.BranchTicketService
+# com.gitblit.tickets.RedisTicketService
+#
+# SINCE 1.4.0
+# RESTART REQUIRED
+tickets.service =
+
+# Globally enable or disable creation of new bug, enhancement, task, etc tickets
+# for all repositories.
+#
+# If false, no tickets can be created through the ui for any repositories.
+# If true, each repository can control if they allow new tickets to be created.
+#
+# NOTE:
+# If a repository is accepting patchsets, new proposal tickets can be created
+# regardless of this setting.
+#
+# SINCE 1.4.0
+tickets.acceptNewTickets = true
+
+# Globally enable or disable pushing patchsets to all repositories.
+#
+# If false, no patchsets will be accepted for any repositories.
+# If true, each repository can control if they accept new patchsets.
+#
+# NOTE:
+# If a repository is accepting patchsets, new proposal tickets can be created
+# regardless of the acceptNewTickets setting.
+#
+# SINCE 1.4.0
+tickets.acceptNewPatchsets = true
+
+# Default setting to control patchset merge through the web ui. If true, patchsets
+# must have an approval score to enable the merge button. This setting can be
+# overriden per-repository.
+#
+# SINCE 1.4.0
+tickets.requireApproval = false
+
+# Default setting to control how patchsets are merged to the integration branch.
+# Valid values:
+# MERGE_ALWAYS - Always merge with a merge commit. Every ticket will show up as a branch,
+# even if it could have been fast-forward merged. This is the default.
+# MERGE_IF_NECESSARY - If possible, fast-forward the integration branch,
+# if not, merge with a merge commit.
+# FAST_FORWARD_ONLY - Only merge when a fast-forward is possible. This produces a strictly
+# linear history of the integration branch.
+#
+# This setting can be overriden per-repository.
+#
+# RESTART REQUIRED
+# SINCE 1.9.0
+tickets.mergeType = MERGE_ALWAYS
+
+# The case-insensitive regular expression used to identify and close tickets on
+# push to the integration branch for commits that are NOT already referenced as
+# a patchset tip.
+#
+# SINCE 1.5.0
+tickets.closeOnPushCommitMessageRegex = (?:fixes|closes)[\\s-]+#?(\\d+)
+
+# The case-insensitive regular expression used to identify and link tickets on
+# push to the commits based on commit message. In the case of a patchset
+# self references are ignored
+#
+# SINCE 1.8.0
+tickets.linkOnPushCommitMessageRegex = (?:ref|task|issue|bug)?[\\s-]*#(\\d+)
+
+# Specify the location of the Lucene Ticket index
+#
+# SINCE 1.4.0
+# RESTART REQUIRED
+tickets.indexFolder = ${baseFolder}/tickets/lucene
+
+# Define the url for the Redis server.
+#
+# e.g. redis://localhost:6379
+# redis://:foobared@localhost:6379/2
+#
+# SINCE 1.4.0
+# RESTART REQUIRED
+tickets.redis.url =
+
+# The number of tickets to display on a page.
+#
+# SINCE 1.4.0
+tickets.perPage = 25
+
+# The folder where plugins are loaded from.
+#
+# SINCE 1.5.0
+# RESTART REQUIRED
+# BASEFOLDER
+plugins.folder = ${baseFolder}/plugins
+
+# The registry of available plugins.
+#
+# SINCE 1.5.0
+plugins.registry = http://plugins.gitblit.com/plugins.json
+
+# The HTTP proxy host for plugin manager.
+#
+# SINCE 1.7.0
+plugins.httpProxyHost =
+
+# The HTTP proxy port for plugin manager.
+#
+# SINCE 1.7.0
+plugins.httpProxyPort =
+
+# The HTTP proxy authorization header for plugin manager.
+#
+# SINCE 1.7.0
+plugins.httpProxyAuthorization =
+
+# Number of threads used to handle miscellaneous tasks in the background.
+#
+# SINCE 1.6.0
+# RESTART REQUIRED
+execution.defaultThreadPoolSize = 1
+
+#
+# Groovy Integration
+#
+
+# Location of Groovy scripts to use for Pre and Post receive hooks.
+# Use forward slashes even on Windows!!
+# e.g. c:/groovy
+#
+# RESTART REQUIRED
+# SINCE 0.8.0
+# BASEFOLDER
+groovy.scriptsFolder = ${baseFolder}/groovy
+
+# Specify the directory Grape uses for downloading libraries.
+# http://groovy.codehaus.org/Grape
+#
+# RESTART REQUIRED
+# SINCE 1.0.0
+# BASEFOLDER
+groovy.grapeFolder = ${baseFolder}/groovy/grape
+
+# Scripts to execute on Pre-Receive.
+#
+# These scripts execute after an incoming push has been parsed and validated
+# but BEFORE the changes are applied to the repository. You might reject a
+# push in this script based on the repository and branch the push is attempting
+# to change.
+#
+# Script names are case-sensitive on case-sensitive file systems. You may omit
+# the traditional ".groovy" from this list if your file extension is ".groovy"
+#
+# NOTE:
+# These scripts are only executed when pushing to Gitblit, not to other Git
+# tooling you may be using. Also note that these scripts are shared between
+# repositories. These are NOT repository-specific scripts! Within the script
+# you may customize the control-flow for a specific repository by checking the
+# repository variable.
+#
+# SPACE-DELIMITED
+# CASE-SENSITIVE
+# SINCE 0.8.0
+groovy.preReceiveScripts =
+
+# Scripts to execute on Post-Receive.
+#
+# These scripts execute AFTER an incoming push has been applied to a repository.
+# You might trigger a continuous-integration build here or send a notification.
+#
+# Script names are case-sensitive on case-sensitive file systems. You may omit
+# the traditional ".groovy" from this list if your file extension is ".groovy"
+#
+# NOTE:
+# These scripts are only executed when pushing to Gitblit, not to other Git
+# tooling you may be using. Also note that these scripts are shared between
+# repositories. These are NOT repository-specific scripts! Within the script
+# you may customize the control-flow for a specific repository by checking the
+# repository variable.
+#
+# SPACE-DELIMITED
+# CASE-SENSITIVE
+# SINCE 0.8.0
+groovy.postReceiveScripts =
+
+# Repository custom fields for Groovy Hook mechanism
+#
+# List of key=label pairs of custom fields to prompt for in the Edit Repository
+# page. These keys are stored in the repository's git config file in the
+# section [gitblit "customFields"]. Key names are alphanumeric only. These
+# fields are intended to be used for the Groovy hook mechanism where a script
+# can adjust it's execution based on the custom fields stored in the repository
+# config.
+#
+# e.g. "commitMsgRegex=Commit Message Regular Expression" anotherProperty=Another
+#
+# SPACE-DELIMITED
+# SINCE 1.0.0
+groovy.customFields =
+
+#
+# Fanout Settings
+#
+
+# Fanout is a PubSub notification service that can be used by Sparkleshare
+# to eliminate repository change polling. The fanout service runs in a separate
+# thread on a separate port from the Gitblit http/https application.
+# This service is provided so that Sparkleshare may be used with Gitblit in
+# firewalled environments or where reliance on Sparkleshare's default notifications
+# server (notifications.sparkleshare.org) is unwanted.
+#
+# This service maintains an open socket connection from the client to the
+# Fanout PubSub service. This service may not work properly behind a proxy server.
+
+# Specify the interface for Fanout to bind it's service.
+# You may specify an ip or an empty value to bind to all interfaces.
+# Specifying localhost will result in Gitblit ONLY listening to requests to
+# localhost.
+#
+# SINCE 1.2.1
+# RESTART REQUIRED
+fanout.bindInterface =
+
+# port for serving the Fanout PubSub service. <= 0 disables this service.
+# On Unix/Linux systems, ports < 1024 require root permissions.
+# Recommended value: 17000
+#
+# SINCE 1.2.1
+# RESTART REQUIRED
+fanout.port = 0
+
+# Use Fanout NIO service. If false, a multi-threaded socket service will be used.
+# Be advised, the socket implementation spawns a thread per connection plus the
+# connection acceptor thread. The NIO implementation is completely single-threaded.
+#
+# SINCE 1.2.1
+# RESTART REQUIRED
+fanout.useNio = true
+
+# Concurrent connection limit. <= 0 disables concurrent connection throttling.
+# If > 0, only the specified number of concurrent connections will be allowed
+# and all other connections will be rejected.
+#
+# SINCE 1.2.1
+# RESTART REQUIRED
+fanout.connectionLimit = 0
+
+#
+# Authentication Settings
+#
+
+# Require authentication to see everything but the admin pages
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+web.authenticateViewPages = false
+
+# If web.authenticateViewPages=true you may optionally require a client-side
+# basic authentication prompt instead of the standard form-based login.
+#
+# SINCE 1.3.0
+web.enforceHttpBasicAuthentication = false
+
+# Require admin authentication for the admin functions and pages
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+web.authenticateAdminPages = true
+
+# Allow Gitblit to store a cookie in the user's browser for automatic
+# authentication. The cookie is generated by the user service.
+#
+# SINCE 0.5.0
+web.allowCookieAuthentication = true
+
+# Allow deletion of non-empty repositories. This is enforced for all delete vectors.
+#
+# SINCE 1.6.0
+web.allowDeletingNonEmptyRepositories = true
+
+# Setting to include personal repositories in the main repositories list.
+#
+# SINCE 1.6.0
+web.includePersonalRepositories = false
+
+# Config file for storing project metadata
+#
+# SINCE 1.2.0
+# BASEFOLDER
+web.projectsFile = ${baseFolder}/projects.conf
+
+# Defines the tab length for all blob views
+#
+# SINCE 1.7.0
+web.tabLength = 4
+
+# Either the full path to a user config file (users.conf)
+# OR a fully qualified class name that implements the IUserService interface.
+#
+# Any custom user service implementation must have a public default constructor.
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+# BASEFOLDER
+realm.userService = ${baseFolder}/users.conf
+
+# Ordered list of external authentication providers which will be used if
+# authentication against the local user service fails.
+#
+# Valid providers are:
+#
+# htpasswd
+# httpheader
+# ldap
+# pam
+# redmine
+# salesforce
+# windows
+
+# e.g. realm.authenticationProviders = htpasswd windows
+#
+# SINCE 1.4.0
+# RESTART REQUIRED
+# SPACE-DELIMITED
+realm.authenticationProviders =
+
+# How to store passwords.
+# Valid values are plain, md5, combined-md5 or pbkdf2.
+# md5 is the hash of password.
+# combined-md5 is the hash of username.toLowerCase()+password.
+# pbkdf2 implements the PBKDF2 algorithm, which is a secure, salted password hashing scheme.
+# Default is pbkdf2. Using plain, md5 or combined-md5 is deprecated, as these are insecure schemes by now.
+#
+# SINCE 0.5.0
+realm.passwordStorage = pbkdf2
+
+# Minimum valid length for a plain text password.
+# Default value is 5. Absolute minimum is 4.
+#
+# SINCE 0.5.0
+realm.minPasswordLength = 5
+
+#
+# Gitblit Web Settings
+#
+# If blank Gitblit is displayed.
+#
+# SINCE 0.5.0
+web.siteName =
+
+# The canonical url of your Gitblit server to be used in repository url generation,
+# RSS feeds, and all embedded links in email and plugin-based notifications.
+#
+# If you are running Gitblit on a non-standard http port (i.e. not 80 and not 443)
+# then you must specify that port in this url otherwise your generated urls will be
+# incorrect.
+#
+# The hostname of this url will be extracted for SSH and GIT protocol repository
+# url generation.
+#
+# e.g. web.canonicalUrl = https://dev.gitblit.com
+# web.canonicalUrl = https://dev.gitblit.com:8443
+#
+# SINCE 1.4.0
+web.canonicalUrl =
+
+# You may specify a different logo image for the header but it must be 120x45px.
+# If the specified file does not exist, the default Gitblit logo will be used.
+#
+# SINCE 1.3.0
+# BASEFOLDER
+web.headerLogo = ${baseFolder}/logo.png
+
+# You may specify a different link URL for the logo image anchor.
+# If blank the Gitblit main page URL is used.
+#
+# SINCE 1.3.0
+# BASEFOLDER
+web.rootLink =
+
+# You may specify a custom header background CSS color. If unspecified, the
+# default color will be used.
+#
+# e.g. web.headerBackgroundColor = #002060
+#
+# SINCE 1.3.0
+web.headerBackgroundColor =
+
+# You may specify a custom header foreground CSS color. If unspecified, the
+# default color will be used.
+#
+# e.g. web.headerForegroundColor = white
+#
+# SINCE 1.3.0
+web.headerForegroundColor =
+
+# You may specify a custom header foreground hover CSS color. If unspecified, the
+# default color will be used.
+#
+# e.g. web.headerHoverColor = white
+#
+# SINCE 1.3.0
+web.headerHoverColor =
+
+# You may specify a custom header border CSS color. If unspecified, the default
+# color will be used.
+#
+# e.g. web.headerBorderColor = #002060
+#
+# SINCE 1.3.0
+web.headerBorderColor =
+
+# You may specify a custom header border CSS color. If unspecified, the default
+# color will be used.
+#
+# e.g. web.headerBorderFocusColor = #ff9900
+#
+# SINCE 1.3.0
+web.headerBorderFocusColor =
+
+# If web.authenticateAdminPages=true, users with "admin" role can create
+# repositories, create users, and edit repository metadata.
+#
+# If web.authenticateAdminPages=false, any user can execute the aforementioned
+# functions.
+#
+# SINCE 0.5.0
+web.allowAdministration = true
+
+# Setting to disable rendering the top-level navigation header which includes
+# the login form, top-level links like dashboard, repositories, search, etc.
+# This setting is only useful if you plan to embed Gitblit within another page
+# or system.
+#
+# SINCE 1.4.0
+web.hideHeader = false
+
+# Allows rpc clients to list repositories and possibly manage or administer the
+# Gitblit server, if the authenticated account has administrator permissions.
+# See web.enableRpcManagement and web.enableRpcAdministration.
+#
+# SINCE 0.7.0
+web.enableRpcServlet = true
+
+# Allows rpc clients to manage repositories and users of the Gitblit instance,
+# if the authenticated account has administrator permissions.
+# Requires web.enableRpcServlet=true.
+#
+# SINCE 0.7.0
+web.enableRpcManagement = false
+
+# Allows rpc clients to control the server settings and monitor the health of this
+# this Gitblit instance, if the authenticated account has administrator permissions.
+# Requires web.enableRpcServlet=true and web.enableRpcManagement.
+#
+# SINCE 0.7.0
+web.enableRpcAdministration = false
+
+# Full path to a configurable robots.txt file. With this file you can control
+# what parts of your Gitblit server respectable robots are allowed to traverse.
+# http://googlewebmastercentral.blogspot.com/2008/06/improving-on-robots-exclusion-protocol.html
+#
+# SINCE 1.0.0
+# BASEFOLDER
+web.robots.txt = ${baseFolder}/robots.txt
+
+# The number of minutes to cache a page in the browser since the last request.
+# The default value is 0 minutes. A value <= 0 disables all page caching which
+# is the default behavior for Gitblit <= 1.3.0.
+#
+# SINCE 1.3.1
+web.pageCacheExpires = 0
+
+# If true, the web ui layout will respond and adapt to the browser's dimensions.
+# if false, the web ui will use a 940px fixed-width layout.
+# http://twitter.github.com/bootstrap/scaffolding.html#responsive
+#
+# SINCE 1.0.0
+web.useResponsiveLayout = true
+
+# Allow Gravatar images to be displayed in Gitblit pages.
+#
+# SINCE 0.8.0
+web.allowGravatar = true
+
+# Define which class will generate the avatar URL.
+#
+# SINCE 1.7.0
+web.avatarClass = com.gitblit.GravatarGenerator
+
+# Allow dynamic zip downloads.
+#
+# SINCE 0.5.0
+web.allowZipDownloads = true
+
+# If web.allowZipDownloads=true the following formats will be displayed for
+# download compressed archive links:
+#
+# zip = standard .zip
+# tar = standard tar format (preserves *nix permissions and symlinks)
+# gz = gz-compressed tar
+# xz = xz-compressed tar
+# bzip2 = bzip2-compressed tar
+#
+# SPACE-DELIMITED
+# SINCE 1.2.0
+web.compressedDownloads = zip gz
+
+# Allow optional Lucene integration. Lucene indexing is an opt-in feature.
+# A repository may specify branches to index with Lucene instead of using Git
+# commit traversal. There are scenarios where you may want to completely disable
+# Lucene indexing despite a repository specifying indexed branches. One such
+# scenario is on a resource-constrained federated Gitblit mirror.
+#
+# SINCE 0.9.0
+web.allowLuceneIndexing = true
+
+# Control the frequency of Lucene repository indexing.
+# The default setting is to check for updated refs every 2 mins.
+#
+# SINCE 1.6.1
+web.luceneFrequency = 2 mins
+
+# Allows an authenticated user to create forks of a repository
+#
+# set this to false if you want to disable all fork controls on the web site
+#
+web.allowForking = true
+
+# Controls the length of shortened commit hash ids
+#
+# SINCE 1.2.0
+web.shortCommitIdLength = 6
+
+# Use a JavaScript browser API to provide a copy-to-clipboard button.
+# The clipboard.js library is used to copy text directly to the browser's
+# clipboard.
+# (This used to be done with a Flash based solution, but has been replaced
+# with a modern JavaScript approach, since Flash support is dying out.)
+# If false, a button with a more primitive JavaScript-based prompt box will
+# offer a 3-step (click, ctrl+c, enter) copy-to-clipboard alternative.
+#
+# SINCE 0.8.0
+web.allowFlashCopyToClipboard = true
+
+# Default maximum number of commits that a repository may contribute to the
+# activity page, regardless of the selected duration. This setting may be valuable
+# for an extremely busy server. This value may also be configed per-repository
+# in Edit Repository. 0 disables this throttle.
+#
+# SINCE 1.2.0
+web.maxActivityCommits = 0
+
+# Default number of entries to include in RSS Syndication links
+#
+# SINCE 0.5.0
+web.syndicationEntries = 25
+
+# Show the size of each repository on the repositories page.
+# This requires recursive traversal of each repository folder. This may be
+# non-performant on some operating systems and/or filesystems.
+#
+# SINCE 0.5.2
+web.showRepositorySizes = true
+
+# List of custom regex expressions that can be displayed in the Filters menu
+# of the Repositories and Activity pages. Keep them very simple because you
+# are likely to run into encoding issues if they are too complex.
+#
+# Use !!! to separate the filters
+#
+# SINCE 0.8.0
+web.customFilters =
+
+# Show federation registrations (without token) and the current pull status
+# to non-administrator users.
+#
+# SINCE 0.6.0
+web.showFederationRegistrations = false
+
+# This is the message displayed when web.authenticateViewPages=true.
+# This can point to a file with Markdown content.
+# Specifying "gitblit" uses the internal login message.
+#
+# SINCE 0.7.0
+# BASEFOLDER
+web.loginMessage = gitblit
+
+# This is the message displayed above the repositories table.
+# This can point to a file with Markdown content.
+# Specifying "gitblit" uses the internal welcome message.
+#
+# SINCE 0.5.0
+# BASEFOLDER
+web.repositoriesMessage = gitblit
+
+# Ordered list of charsets/encodings to use when trying to display a blob.
+# If empty, UTF-8 and ISO-8859-1 are used. The server's default charset
+# is always appended to the encoding list. If all encodings fail to cleanly
+# decode the blob content, UTF-8 will be used with the standard malformed
+# input/unmappable character replacement strings.
+#
+# SPACE-DELIMITED
+# SINCE 1.0.0
+web.blobEncodings = UTF-8 ISO-8859-1
+
+# Manually set the default timezone to be used by Gitblit for display in the
+# web ui. This value is independent of the JVM timezone. Specifying a blank
+# value will default to the JVM timezone.
+# e.g. America/New_York, US/Pacific, UTC, Europe/Berlin
+#
+# SINCE 0.9.0
+# RESTART REQUIRED
+web.timezone =
+
+# Use the client timezone when formatting dates.
+# This uses AJAX to determine the browser's timezone and may require more
+# server overhead because a Wicket session is created. All Gitblit pages
+# attempt to be stateless, if possible.
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+web.useClientTimezone = false
+
+# Time format
+# http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
+#
+# SINCE 0.8.0
+web.timeFormat = HH:mm
+
+# Short date format
+# http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
+#
+# SINCE 0.5.0
+web.datestampShortFormat = yyyy-MM-dd
+
+# Long date format
+#
+# SINCE 0.8.0
+web.datestampLongFormat = EEEE, MMMM d, yyyy
+
+# Long timestamp format
+# http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
+#
+# SINCE 0.5.0
+web.datetimestampLongFormat = EEEE, MMMM d, yyyy HH:mm Z
+
+# Mount URL parameters
+# This setting controls if pretty or parameter URLs are used.
+# i.e.
+# if true:
+# http://localhost/commit/myrepo/abcdef
+# if false:
+# http://localhost/commit/?r=myrepo&h=abcdef
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+web.mountParameters = true
+
+# Some servlet containers (e.g. Tomcat >= 6.0.10) disallow '/' (%2F) encoding
+# in URLs as a security precaution for proxies. This setting tells Gitblit
+# to preemptively replace '/' with '*' or '!' for url string parameters.
+#
+# https://issues.apache.org/jira/browse/WICKET-1303
+# http://tomcat.apache.org/security-6.html#Fixed_in_Apache_Tomcat_6.0.10
+# Add -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true to your
+# CATALINA_OPTS or to your JVM launch parameters
+#
+# SINCE 0.5.2
+web.forwardSlashCharacter = /
+
+# Show other URLs on the summary page for accessing your git repositories
+# Use spaces to separate urls.
+#
+# {0} is the token for the repository name
+# {1} is the token for the username
+#
+# The username is only practical if you have setup your other git serving
+# solutions accounts to have the same username as the Gitblit account.
+#
+# e.g.
+# web.otherUrls = ssh://localhost/git/{0} git://localhost/git/{0} https://{1}@localhost/r/{0}
+#
+# SPACE-DELIMITED
+# SINCE 0.5.0
+web.otherUrls =
+
+# Should HTTP/HTTPS URLs be displayed if the git servlet is enabled?
+# default: true
+#
+# SINCE 1.7.0
+web.showHttpServletUrls = true
+
+# Should git URLs be displayed if the git daemon is enabled?
+# default: true
+#
+# SINCE 1.7.0
+web.showGitDaemonUrls = true
+
+# Should SSH URLs be displayed if the SSH daemon is enabled?
+# default: true
+#
+# SINCE 1.7.0
+web.showSshDaemonUrls = true
+
+# Should effective permissions be advertised for access paths defined in web.otherUrls?
+# If false, gitblit will indicate unknown permissions for the external link. If true,
+# gitblit will indicate permissions as defined within gitblit (including limiting to clone
+# permission is the transport type is not a valid push mechaism in git.acceptedPushTransports).
+#
+# Configure with caution: Note that gitblit has no way of knowing if further restrictions
+# are imposed by an external forwarding agent, so this may cause user confusion due to
+# more rights being advertised than are available through the URL. It will NOT grant
+# additional rights, but may incorrectly offer actions that are unavailable externally.
+# default: false
+#
+# SINCE 1.7.0
+web.advertiseAccessPermissionForOtherUrls = false
+
+# Should app-specific clone links be displayed for SourceTree, SparkleShare, etc?
+#
+# SINCE 1.3.0
+web.allowAppCloneLinks = true
+
+# Choose how to present the repositories list.
+# grouped = group nested/subfolder repositories together (no sorting)
+# flat = flat list of repositories (sorting allowed)
+# tree = group nested/subfolder repositories in a tree structure with folding branches
+#
+# SINCE 0.5.0
+web.repositoryListType = grouped
+
+# If using a grouped repository list and there are repositories at the
+# root level of your repositories folder, you may specify the displayed
+# group name with this setting. This value is only used for web presentation.
+#
+# SINCE 0.5.0
+web.repositoryRootGroupName = main
+
+# Display the repository swatch color next to the repository name link in the
+# repositories list.
+#
+# SINCE 0.8.0
+web.repositoryListSwatches = true
+
+# Specify the behaviour of the Repository groups on the "Repositories"
+# page, specifically whether they can be collapsed and expanded, and
+# their default state on loading the page.
+# Only on repositoryListType grouped
+#
+# Values (case-insensitive):
+# disabled - Repository groups cannot collapsed; maintains behaviour
+# from previous versions of GitBlit.
+# expanded - On loading the page all repository groups are expanded.
+# collapsed - On loading the page all repository groups are collapsed.
+#
+# SINCE 1.9.0
+web.collapsibleRepositoryGroups = expanded
+
+# Defines the default commit message renderer. This can be configured
+# per-repository.
+#
+# Valid values are: plain, markdown
+#
+# SINCE 1.4.0
+web.commitMessageRenderer = plain
+
+# Control if email addresses are shown in web ui
+#
+# SINCE 0.5.0
+web.showEmailAddresses = true
+
+# Shows a combobox in the page links header with commit, committer, and author
+# search selection. Default search is commit.
+#
+# SINCE 0.5.0
+web.showSearchTypeSelection = false
+
+# Controls display of activity graphs on the dashboard, activity, and summary
+# pages. Charts are generated using Flotr2; an open source HTML5 library.
+#
+# SINCE 0.5.0
+web.generateActivityGraph = true
+
+# Displays the commits branch graph in the summary page and commits/log page.
+#
+# SINCE 1.4.0
+web.showBranchGraph = true
+
+# The default number of days to show on the activity page.
+# Value must exceed 0 else default of 7 is used
+#
+# SINCE 0.8.0
+web.activityDuration = 7
+
+# Choices for days of activity to display.
+#
+# SPACE-DELIMITED
+# SINCE 1.3.0
+web.activityDurationChoices = 1 3 7 14 21 28
+
+# Maximum number of days of activity that may be displayed on the activity page.
+#
+# SINCE 1.3.2
+web.activityDurationMaximum = 30
+
+# The number of days of commits to cache in memory for the dashboard, activity,
+# and project pages. A value of 0 will disable all caching and will parse commits
+# in each repository per-request. If the value > 0 these pages will try to fulfill
+# requests using the commit cache. If the request specifies a period which falls
+# outside the commit cache window, then the cache will be ignored and the request
+# will be fulfilled by brute-force parsing all relevant commits per-repository.
+#
+# Consider the values specified for web.activityDurationChoices when setting
+# the cache size AND consider adjusting the JVM -Xmx heap parameter appropriately.
+#
+# SINCE 1.3.0
+# RESTART REQUIRED
+web.activityCacheDays = 14
+
+# Case-insensitive list of authors to exclude from metrics. Useful for
+# eliminating bots.
+#
+# SPACE-DELIMITED
+# SINCE 1.3.0
+web.metricAuthorExclusions =
+
+# The number of commits to display on the summary page
+# Value must exceed 0 else default of 20 is used
+#
+# SINCE 0.5.0
+web.summaryCommitCount = 16
+
+# The number of tags/branches to display on the summary page.
+# -1 = all tags/branches
+# 0 = hide tags/branches
+# N = N tags/branches
+#
+# SINCE 0.5.0
+web.summaryRefsCount = 5
+
+# Show a README file, if available, on the summary page.
+#
+# SINCE 1.4.0
+web.summaryShowReadme = false
+
+# The number of items to show on a page before showing the first, prev, next
+# pagination links. A default of 50 is used for any invalid value.
+#
+# SINCE 0.5.0
+web.itemsPerPage = 50
+
+# The number of reflog changes to display on the overview page
+# Value must exceed 0 else default of 5 is used
+#
+# SINCE 1.3.0
+web.overviewReflogCount = 5
+
+# The number of reflog changes to show on a reflog page before show the first,
+# prev, next pagination links. A default of 10 is used for any invalid value.
+#
+# SINCE 1.3.0
+web.reflogChangesPerPage = 10
+
+# Specify the names of documents in the root of your repository to be displayed
+# in tabs on your repository docs page. If the name is not found in the root
+# then no tab is added. The order specified is the order displayed. Do not
+# specify a file extension as the aggregation of markup extensions + txt are used
+# in the search algorithm.
+#
+# SPACE-DELIMITED
+# SINCE 1.4.0
+web.documents = readme home index changelog contributing submitting_patches copying license notice authors
+
+# Registered file extensions to ignore during Lucene indexing
+#
+# SPACE-DELIMITED
+# SINCE 0.9.0
+web.luceneIgnoreExtensions = 7z arc arj bin bmp dll doc docx exe gif gz jar jpg lib lzh odg odf odt pdf ppt pptx png so swf tar xcf xls xlsx zip
+
+# Registered extensions for google-code-prettify
+#
+# SPACE-DELIMITED
+# SINCE 0.5.0
+web.prettyPrintExtensions = aea agc basic bat c cbm cl clj cmd cpp cs css dart el erl erlang frm fs go groovy h hpp hs htm html java js latex lisp ll llvm lsp lua ml moxie mumps n nemerle pascal php pl pm prefs properties proto py r R rb rd Rd rkt s S scala scm sh Splus sql ss tcl tex vb vbs vhd vhdl wiki xml xq xquery yaml yml ymlapollo
+
+# Registered extensions for markdown transformation
+#
+# SPACE-DELIMITED
+# CASE-SENSITIVE
+# SINCE 0.5.0
+web.markdownExtensions = md mkd markdown MD MKD
+
+# Registered extensions for mediawiki transformation
+#
+# SPACE-DELIMITED
+# CASE-SENSITIVE
+# SINCE 1.4.0
+web.mediawikiExtensions = mw mediawiki
+
+# Registered extensions for twiki transformation
+#
+# SPACE-DELIMITED
+# CASE-SENSITIVE
+# SINCE 1.4.0
+web.twikiExtensions = twiki
+
+# Registered extensions for textile transformation
+#
+# SPACE-DELIMITED
+# CASE-SENSITIVE
+# SINCE 1.4.0
+web.textileExtensions = textile
+
+# Registered extensions for confluence transformation
+#
+# SPACE-DELIMITED
+# CASE-SENSITIVE
+# SINCE 1.4.0
+web.confluenceExtensions = confluence
+
+# Registered extensions for tracwiki transformation
+#
+# SPACE-DELIMITED
+# CASE-SENSITIVE
+# SINCE 1.4.0
+web.tracwikiExtensions = tracwiki
+
+# Image extensions
+#
+# SPACE-DELIMITED
+# SINCE 0.5.0
+web.imageExtensions = bmp ico gif jpg jpeg png svg
+
+# Registered extensions for binary blobs
+#
+# SPACE-DELIMITED
+# SINCE 0.5.0
+web.binaryExtensions = 7z arc arj bin dll doc docx exe gz jar lib lzh odg odf odt pdf ppt pptx so tar xls xlsx zip
+
+# Aggressive heap management will run the garbage collector on every generated
+# page. This slows down page generation a little but improves heap consumption.
+#
+# SINCE 0.5.0
+web.aggressiveHeapManagement = false
+
+# Run the webapp in debug mode
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+web.debugMode = false
+
+# Allows to hide the user logon form or dropdown menu from the top pane
+# if it's not needed.
+#
+# SINCE 1.7.0
+web.displayUserPanel = true
+
+# Force a default locale for all users, ignoring the browser's settings.
+# An empty value allows Gitblit to use the translation preferred by the browser.
+#
+# Changing this value while the server is running will only affect new sessions.
+#
+# e.g. web.forceDefaultLocale = en
+#
+# SINCE 1.3.0
+web.forceDefaultLocale =
+
+# The following two settings serve to avoid browser overload when trying to
+# render very large diffs. Both limits apply to commitdiffs, not to single-file
+# diffs.
+
+# Maximum number of diff lines to display for a single file diff in a commitdiff.
+# Defaults to 4000; can be adjusted in the range [500 .. 4000]. Smaller values
+# set the limit to 500, larger values to 4000. The count includes context lines
+# in the diff.
+#
+# If a file diff in a commitdiff produces more lines, the diff for that file is
+# not shown in the commitdiff.
+#
+# SINCE 1.7.0
+web.maxDiffLinesPerFile = 4000
+
+# Total maximum number of diff lines to show in a commitdiff. Defaults to 20000;
+# can be adjusted in the range [1000 .. 20000]. Smaller values set the limit to
+# 1000, larger values to 20000. The count includes context lines in diffs.
+#
+# If a commitdiff produces more lines, it is truncated after the first file
+# that exceeds the limit. Diffs for subsequent files in the commit are not shown
+# at all in the commitdiff. Omitted files are listed, though.
+#
+# SINCE 1.7.0
+web.maxDiffLines = 20000
+
+# Enable/disable global regex substitutions (i.e. shared across repositories)
+#
+# SINCE 0.5.0
+# DEPRECATED 1.4.0 (migrate to bugtraq instead)
+regex.global = true
+
+# Example global regex substitutions
+# Use !!! to separate the search pattern and the replace pattern
+# searchpattern!!!replacepattern
+# SINCE 0.5.0
+
+# regex.global.bug = \b(Bug:)(\s*[#]?|-){0,1}(\d+)\b!!!Bug: $3
+# SINCE 0.5.0
+
+# Example Gerrit links
+# regex.global.changeid = \b(Change-Id:\s*)([A-Za-z0-9]*)\b!!!Change-Id: $2
+# regex.global.reviewedon = \b(Reviewed-on:\s*)([A-Za-z0-9:/\.]*)\b!!!Reviewed-on: $2
+
+# Example per-repository regex substitutions overrides global
+# SINCE 0.5.0
+# regex.myrepository.bug = \b(Bug:)(\s*[#]?|-){0,1}(\d+)\b!!!Bug: $3
+
+#
+# Mail Settings
+# SINCE 0.6.0
+#
+# Mail settings are used to notify administrators of received federation proposals
+#
+
+# ip or hostname of smtp server
+#
+# SINCE 0.6.0
+mail.server =
+
+# port to use for smtp requests
+#
+# SINCE 0.6.0
+mail.port = 25
+
+# debug the mail executor
+#
+# SINCE 0.6.0
+mail.debug = false
+
+# use SMTPs flag
+mail.smtps = false
+
+# use STARTTLS flag
+#
+# SINCE 1.6.0
+mail.starttls = false
+
+# if your smtp server requires authentication, supply the credentials here
+#
+# SINCE 0.6.0
+mail.username =
+# SINCE 0.6.0
+mail.password =
+
+# from address for generated emails
+#
+# SINCE 0.6.0
+mail.fromAddress =
+
+# List of email addresses for the Gitblit administrators
+#
+# SPACE-DELIMITED
+# SINCE 0.6.0
+mail.adminAddresses =
+
+# List of email addresses for sending push email notifications.
+#
+# This key currently requires use of the sendemail.groovy hook script.
+# If you set sendemail.groovy in groovy.postReceiveScripts then email
+# notifications for all repositories (regardless of access restrictions!)
+# will be sent to these addresses.
+#
+# SPACE-DELIMITED
+# SINCE 0.8.0
+mail.mailingLists =
+
+#
+# Federation Settings
+# SINCE 0.6.0
+#
+# A Gitblit federation is a way to backup one Gitblit instance to another.
+#
+# git.enableGitServlet must be true to use this feature.
+
+# Your federation name is used for federation status acknowledgments. If it is
+# unset, and you elect to send a status acknowledgment, your Gitblit instance
+# will be identified by its hostname, if available, else your internal ip address.
+# The source Gitblit instance will also append your external IP address to your
+# identification to differentiate multiple pulling systems behind a single proxy.
+#
+# SINCE 0.6.0
+federation.name =
+
+# Specify the passphrase of this Gitblit instance.
+#
+# An unspecified (empty) passphrase disables processing federation requests.
+#
+# This value can be anything you want: an integer, a sentence, an haiku, etc.
+# Keep the value simple, though, to avoid Java properties file encoding issues.
+#
+# Changing your passphrase will break any registrations you have established with other
+# Gitblit instances.
+#
+# CASE-SENSITIVE
+# SINCE 0.6.0
+# RESTART REQUIRED (only to enable or disable federation)
+federation.passphrase =
+
+# Control whether or not this Gitblit instance can receive federation proposals
+# from another Gitblit instance. Registering a federated Gitblit is a manual
+# process. Proposals help to simplify that process by allowing a remote Gitblit
+# instance to send your Gitblit instance the federation pull data.
+#
+# SINCE 0.6.0
+federation.allowProposals = false
+
+# The destination folder for cached federation proposals.
+# Use forward slashes even on Windows!!
+#
+# SINCE 0.6.0
+# BASEFOLDER
+federation.proposalsFolder = ${baseFolder}/proposals
+
+# The default pull frequency if frequency is unspecified on a registration
+#
+# SINCE 0.6.0
+federation.defaultFrequency = 60 mins
+
+# Federation Sets are named groups of repositories. The Federation Sets are
+# available for selection in the repository settings page. You can assign a
+# repository to one or more sets and then distribute the token for the set.
+# This allows you to grant federation pull access to a subset of your available
+# repositories. Tokens for federation sets only grant repository pull access.
+#
+# SPACE-DELIMITED
+# CASE-SENSITIVE
+# SINCE 0.6.0
+federation.sets =
+
+# Federation pull registrations
+# Registrations are read once, at startup.
+#
+# RESTART REQUIRED
+#
+# frequency:
+# The shortest frequency allowed is every 5 minutes
+# Decimal frequency values are cast to integers
+# Frequency values may be specified in mins, hours, or days
+# Values that can not be parsed or are unspecified default to federation.defaultFrequency
+#
+# folder:
+# if unspecified, the folder is git.repositoriesFolder
+# if specified, the folder is relative to git.repositoriesFolder
+#
+# bare:
+# if true, each repository will be created as a bare repository and will not
+# have a working directory.
+#
+# if false, each repository will be created as a normal repository suitable
+# for local work.
+#
+# mirror:
+# if true, each repository HEAD is reset to origin/master after each pull.
+# The repository will be flagged isFrozen after the initial clone.
+#
+# if false, each repository HEAD will point to the FETCH_HEAD of the initial
+# clone from the origin until pushed to or otherwise manipulated.
+#
+# mergeAccounts:
+# if true, remote accounts and their permissions are merged into your
+# users.properties file
+#
+# notifyOnError:
+# if true and the mail configuration is properly set, administrators will be
+# notified by email of pull failures
+#
+# include and exclude:
+# Space-delimited list of repositories to include or exclude from pull
+# may be * wildcard to include or exclude all
+# may use fuzzy match (e.g. org.eclipse.*)
+
+#
+# (Nearly) Perfect Mirror example
+#
+
+# federation.example1.url = https://go.gitblit.com
+# federation.example1.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4
+# federation.example1.frequency = 120 mins
+# federation.example1.folder =
+# federation.example1.bare = true
+# federation.example1.mirror = true
+# federation.example1.mergeAccounts = true
+
+#
+# Advanced Realm Settings
+#
+
+# Auto-creates user accounts based on the servlet container principal. This
+# assumes that your Gitblit install is a protected resource and your container's
+# authentication process intercepts all Gitblit requests.
+#
+# SINCE 1.3.0
+realm.container.autoCreateAccounts = false
+
+# A set of mapping used to map HTTP session attributes to user informations
+# They are used if realm.container.autoCreateAccounts is set to true and
+# the webapp container used can fill the session with user informations
+#
+# SINCE 1.7.0
+realm.container.autoAccounts.displayName =
+realm.container.autoAccounts.emailAddress =
+realm.container.autoAccounts.locale =
+
+# If the user's created by the webapp container is given this role,
+# the user created will be a admin user.
+#
+# SINCE 1.7.0
+realm.container.autoAccounts.adminRole =
+
+
+# Allow or prohibit Windows guest account logins
+#
+# SINCE 1.3.0
+realm.windows.allowGuests = false
+
+# Allow user accounts belonging to the BUILTIN\Administrators group to be
+# Gitblit administrators.
+#
+# SINCE 1.4.0
+realm.windows.permitBuiltInAdministrators = true
+
+# The default domain for authentication.
+#
+# If specified, this domain will be used for authentication UNLESS the supplied
+# login name manually specifies a domain (.e.g. mydomain\james or james@mydomain)
+#
+# If unspecified, the username must be specified in UPN format (name@domain).
+#
+# if "." (dot) is specified, ONLY the local account database will be used.
+#
+# SINCE 1.3.0
+realm.windows.defaultDomain =
+
+# The PAM service name for authentication.
+# default: system-auth
+#
+# SINCE 1.3.1
+realm.pam.serviceName = system-auth
+
+# The Apache htpasswd file that contains the users and passwords.
+# default: ${baseFolder}/htpasswd
+#
+# RESTART REQUIRED
+# BASEFOLDER
+# SINCE 1.3.2
+realm.htpasswd.userfile = ${baseFolder}/htpasswd
+
+# The name of the HTTP header containing the user name to trust as authenticated
+# default: none
+#
+# WARNING: only use this mechanism if your requests are coming from a trusted
+# and secure source such as a self managed reverse proxy!
+#
+# RESTART REQUIRED
+# SINCE 1.7.2
+realm.httpheader.userheader =
+
+# The name of the HTTP header containing the team names of which the user is a member.
+# If this is defined, then only groups from the headers will be available, whereas
+# if this remains undefined, then local groups will be used.
+#
+# This setting requires that you have configured realm.httpheader.userheader.
+#
+# default: none
+#
+# RESTART REQUIRED
+# SINCE 1.7.2
+realm.httpheader.teamheader =
+
+# The regular expression pattern used to separate team names in the team header value
+# default: ,
+#
+# This setting requires that you have configured realm.httpheader.teamheader
+#
+# RESTART REQUIRED
+# SINCE 1.7.2
+realm.httpheader.teamseparator = ,
+
+# Auto-creates user accounts when successfully authenticated based on HTTP headers.
+#
+# SINCE 1.7.2
+realm.httpheader.autoCreateAccounts = false
+
+# Restrict the Salesforce user to members of this org.
+# default: 0 (i.e. do not check the Org ID)
+#
+# SINCE 1.3.0
+realm.salesforce.orgId = 0
+
+# URL of the LDAP server.
+# To use encrypted transport, use either ldaps:// URL for SSL or ldap+tls:// to
+# send StartTLS command.
+#
+# SINCE 1.0.0
+realm.ldap.server = ldap://localhost
+
+# Login username for LDAP searches.
+# This is usually a user with permissions to search LDAP users and groups.
+# It must have at least have the permission to search users. If it does not
+# have permission to search groups, the normal user logging in must have
+# the permission in LDAP to search groups.
+# If this value is unspecified, anonymous LDAP login will be used.
+#
+# e.g. mydomain\username
+#
+# SINCE 1.0.0
+realm.ldap.username = cn=Directory Manager
+
+# Login password for LDAP searches.
+#
+# SINCE 1.0.0
+realm.ldap.password = password
+
+# Bind pattern for user authentication.
+# Allow to directly authenticate an user without searching for it in LDAP.
+# Use this if the LDAP server does not allow anonymous access and you don't
+# want to use a specific account to run searches. When set, it will override
+# the settings realm.ldap.username and realm.ldap.password.
+# This requires that all relevant user entries are children to the same DN,
+# and that logging users have permission to search for their groups in LDAP.
+# This will disable synchronization as a specific LDAP account is needed for that.
+#
+# e.g. CN=${username},OU=Users,OU=UserControl,OU=MyOrganization,DC=MyDomain
+#
+# SINCE 1.5.0
+realm.ldap.bindpattern =
+
+
+# Delegate team membership control to LDAP.
+#
+# If true, team user memberships will be specified by LDAP groups. This will
+# disable team selection in Edit User and user selection in Edit Team.
+#
+# If false, LDAP will only be used for authentication and Gitblit will maintain
+# team memberships with the realm.ldap.backingUserService.
+#
+# SINCE 1.0.0
+realm.ldap.maintainTeams = false
+
+# Root node for all LDAP users
+#
+# This is the root node from which subtree user searches will begin.
+# If blank, Gitblit will search ALL nodes.
+#
+# SINCE 1.0.0
+realm.ldap.accountBase = OU=Users,OU=UserControl,OU=MyOrganization,DC=MyDomain
+
+# Filter criteria for LDAP users
+#
+# Query pattern to use when searching for a user account. This may be any valid
+# LDAP query expression, including the standard (&) and (|) operators.
+#
+# Variables may be injected via the ${variableName} syntax.
+# Recognized variables are:
+# ${username} - The text entered as the user name
+#
+# SINCE 1.0.0
+realm.ldap.accountPattern = (&(objectClass=person)(sAMAccountName=${username}))
+
+# Root node for all LDAP groups to be used as Gitblit Teams
+#
+# This is the root node from which subtree team searches will begin.
+# If blank, Gitblit will search ALL nodes.
+#
+# SINCE 1.0.0
+realm.ldap.groupBase = OU=Groups,OU=UserControl,OU=MyOrganization,DC=MyDomain
+
+# Filter criteria for LDAP groups
+#
+# Query pattern to use when searching for a team. This may be any valid
+# LDAP query expression, including the standard (&) and (|) operators.
+#
+# Variables may be injected via the ${variableName} syntax.
+# Recognized variables are:
+# ${username} - The text entered as the user name
+# ${dn} - The Distinguished Name of the user logged in
+#
+# All attributes from the LDAP User record are available. For example, if a user
+# has an attribute "fullName" set to "John", "(fn=${fullName})" will be
+# translated to "(fn=John)".
+#
+# SINCE 1.0.0
+realm.ldap.groupMemberPattern = (&(objectClass=group)(member=${dn}))
+
+# Filter criteria for empty LDAP groups
+#
+# Query pattern to use when searching for an empty team. This may be any valid
+# LDAP query expression, including the standard (&) and (|) operators.
+#
+# default: (&(objectClass=group)(!(member=*)))
+# SINCE 1.4.0
+realm.ldap.groupEmptyMemberPattern = (&(objectClass=group)(!(member=*)))
+
+# LDAP users or groups that should be given administrator privileges.
+#
+# Teams are specified with a leading '@' character. Groups with spaces in the
+# name can be entered as "@team name". This setting only applies when using
+# LDAP to maintain team memberships.
+#
+# e.g. realm.ldap.admins = john @git_admins "@git admins"
+#
+# SPACE-DELIMITED
+# SINCE 1.0.0
+realm.ldap.admins = @Git_Admins
+
+# Attribute(s) on the USER record that indicate their display (or full) name.
+# Leave blank for no mapping available in LDAP.
+#
+# This may be a single attribute, or a string of multiple attributes. Examples:
+# displayName - Uses the attribute 'displayName' on the user record
+# ${personalTitle}. ${givenName} ${surname} - Will concatenate the 3
+# attributes together, with a '.' after personalTitle
+#
+# SINCE 1.0.0
+realm.ldap.displayName = displayName
+
+# Attribute(s) on the USER record that indicate their email address.
+# Leave blank for no mapping available in LDAP.
+#
+# This may be a single attribute, or a string of multiple attributes. Examples:
+# email - Uses the attribute 'email' on the user record
+# ${givenName}.${surname}@gitblit.com -Will concatenate the 2 attributes
+# together with a '.' and '@' creating something like first.last@gitblit.com
+#
+# SINCE 1.0.0
+realm.ldap.email = email
+
+# Attribute on the USER record that indicate their username to be used in gitblit
+# when synchronizing users from LDAP
+# if blank, Gitblit will use uid
+# For MS Active Directory this may be sAMAccountName
+#
+# SINCE 1.0.0
+realm.ldap.uid = uid
+
+# Attribute on the USER record that indicates their public SSH key.
+# Leave blank when public SSH keys shall not be retrieved from LDAP.
+#
+# This setting is only relevant when a public key manager is used that
+# retrieves SSH keys from LDAP (e.g. com.gitblit.transport.ssh.LdapKeyManager).
+#
+# The accepted format of the value is dependent on the public key manager used.
+# Examples:
+# sshPublicKey - Use the attribute 'sshPublicKey' on the user record.
+# altSecurityIdentities:SshKey - Use the attribute 'altSecurityIdentities'
+# on the user record, for which the record value
+# starts with 'SshKey:', followed by the SSH key entry.
+#
+# SINCE 1.9.0
+realm.ldap.sshPublicKey =
+
+# Defines whether to synchronize all LDAP users and teams into the user service
+# This requires either anonymous LDAP access or that a specific account is set
+# in realm.ldap.username and realm.ldap.password, that has permission to read
+# users and groups in LDAP.
+#
+# Valid values: true, false
+# If left blank, false is assumed
+#
+# SINCE 1.4.0
+realm.ldap.synchronize = false
+
+# Defines the period to be used when synchronizing users and teams from ldap.
+#
+# Must be of the form '' where is one of 'MILLISECONDS', 'SECONDS', 'MINUTES', 'HOURS', 'DAYS'
+
+# default: 5 MINUTES
+#
+# RESTART REQUIRED
+# SINCE 1.4.0
+realm.ldap.syncPeriod = 5 MINUTES
+
+# Defines whether to delete non-existent LDAP users from the user service
+# during synchronization. depends on realm.ldap.synchronize = true
+#
+# Valid values: true, false
+# If left blank, true is assumed
+#
+# SINCE 1.4.0
+realm.ldap.removeDeletedUsers = true
+
+# URL of the Redmine.
+#
+# SINCE 1.2.0
+realm.redmine.url = http://example.com/redmine
+
+#
+# Gitblit GO Server Settings
+# The following settings only affect the integrated GO variant.
+#
+
+# The temporary folder to decompress the embedded gitblit webapp.
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+# BASEFOLDER
+server.tempFolder = ${baseFolder}/temp
+
+# Specify the maximum number of concurrent http/https Jetty worker
+# threads to allow. This setting does not affect other threaded
+# daemons and components of Gitblit.
+#
+# SINCE 1.3.0
+# RESTART REQUIRED
+server.threadPoolSize = 50
+
+# Context path for the GO application. You might want to change the context
+# path if running Gitblit behind a proxy layer such as mod_proxy.
+#
+# SINCE 0.7.0
+# RESTART REQUIRED
+server.contextPath = /
+
+# Standard http port to serve. <= 0 disables this connector.
+# On Unix/Linux systems, ports < 1024 require root permissions.
+# Recommended value: 80 or 8080
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+server.httpPort = 0
+
+# Secure/SSL https port to serve. <= 0 disables this connector.
+# On Unix/Linux systems, ports < 1024 require root permissions.
+# Recommended value: 443 or 8443
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+server.httpsPort = 8443
+
+# Automatically redirect http requests to the secure https connector.
+#
+# This setting requires that you have configured server.httpPort and server.httpsPort.
+# Unless you are on a private LAN where you trust all client connections, it is
+# recommended to use https for all communications.
+#
+# SINCE 1.4.0
+# RESTART REQUIRED
+server.redirectToHttpsPort = false
+
+# Specify the interface for Jetty to bind the standard connector.
+# You may specify an ip or an empty value to bind to all interfaces.
+# Specifying localhost will result in Gitblit ONLY listening to requests to
+# localhost.
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+server.httpBindInterface =
+
+# Specify the interface for Jetty to bind the secure connector.
+# You may specify an ip or an empty value to bind to all interfaces.
+# Specifying localhost will result in Gitblit ONLY listening to requests to
+# localhost.
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+server.httpsBindInterface =
+
+# Alias of certificate to use for https/SSL serving. If blank the first
+# certificate found in the keystore will be used.
+#
+# SINCE 1.2.0
+# RESTART REQUIRED
+server.certificateAlias = localhost
+
+# Password for SSL keystore.
+# Keystore password and certificate password must match.
+# This is provided for convenience, its probably more secure to set this value
+# using the --storePassword command line parameter.
+#
+# If you are using the official JRE or JDK from Oracle you may not have the
+# JCE Unlimited Strength Jurisdiction Policy files bundled with your JVM. Because
+# of this, your store/key password can not exceed 7 characters. If you require
+# longer passwords you may need to install the JCE Unlimited Strength Jurisdiction
+# Policy files from Oracle.
+#
+# http://www.oracle.com/technetwork/java/javase/downloads/index.html
+#
+# Gitblit and the Gitblit Certificate Authority will both indicate if Unlimited
+# Strength encryption is available.
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+server.storePassword = gitblit
+
+# If serving over https (recommended) you might consider requiring clients to
+# authenticate with TLS certificates.
+#
+# Possible values are: 'required' (or 'true'), 'optional' (or 'false') and 'none'
+#
+# If required, only https clients with a valid client certificate will be able
+# to access Gitblit.
+#
+# If optional, client certificate authentication is optional and will be tried
+# first before falling-back to form authentication or basic authentication.
+#
+# If completely disabled ('none'), then the server will not ask the client to
+# present a client certificate at all.
+#
+# Requiring client certificates to access any of Gitblit may be too extreme,
+# consider this carefully.
+#
+# SINCE 1.2.0
+# RESTART REQUIRED
+server.requireClientCertificates = optional
+
+# If enabled, client certificate authentication is optional and will be tried
+# first before falling-back to form authentication or basic authentication.
+#
+# If disabled, no client certificate authentication will be done at all.
+#
+# SINCE 1.8.1
+# RESTART REQUIRED
+server.wantClientCertificates = false
+
+# Port for shutdown monitor to listen on.
+#
+# SINCE 0.5.0
+# RESTART REQUIRED
+server.shutdownPort = 8081
+
+# Http idle Timeout (in milliseconds) for http and https requests
+# Increase this value if you get java.util.concurrent.TimeoutException errors
+#
+# SINCE 1.9.0
+# RESTART REQUIRED
+server.httpIdleTimeout = 30000
+
+#
+# Gitblit Filestore Settings
+#
+# The location to save the filestore blobs
+#
+# SINCE 1.7.0
+filestore.storageFolder = ${baseFolder}/lfs
+
+# Maximum allowable upload size
+# The default value, -1, disables upload limits.
+# Common unit suffixes of k, m, or g are supported.
+# SINCE 1.7.0
+filestore.maxUploadSize = -1
+
+
+
Current Release (1.10.0) this is the current stable release
+
+
+
+
2025-06-14
+
+
+
Highlights:
* Support for ECDSA and Ed25519 SSH keys * Fix vulnerability that allowed SSH authentication to be circumvented * Explicitly disable requesting optional client TLS certificates * Copy-to-clipboard button is back and working * Minimal required Java version is Java 8
While old DSA SSH host keys can still be used, a new Gitblit installation will no longer generate a DSA host key. The default set of host keys is now RSA, ECDSA and Ed25519.
Snapshot builds of the current master branch are now available as Docker containers on Docker Hub under the "Nightly" tag.
+
+
+
Note
+ This release fixes a vulnerability allowing an attacker to circumvent authentication on the SSH transport. Users are urged to update to this version.Should you have disabled the Flash-based copy-to-clipboard function because it wasn't working anymore (`web.allowFlashCopyToClipboard = false`), you may want to rethink this and enable it again. The configuration property has the same name, but the mechanism was exchanged. Flash is gone, and a modern JavaScript solution is now used to copy text directly to the clipboard (via clipboard.js).The setting `server.requireClientCertificates` now has three values: `required`, `optional` and `none`. While `required` is synonymous to the old `true` value, and `optional` is synonymous to the old `false` value, the new `none` value results in the server never asking the client to present any client certificate at all. The old values `true` and `false` can still be used and keep their meaning.From 1.10.0 on Gitblit requires Java 8 as minimal Java version.
+
+
+
security
+
+
Fix path traversal vulnerability which allowed access to "/resources//../WEB-INF/". (CVE-2022-31268) This was fixed by updating Jetty. (issue 1409)
+
Fix exploit circumventing SSH authentication. Many thanks to András Veres-Szentkirályi (silentsignal.eu) for the report. (CVE-2024-28080)
+
Fix vulnerability exposing user password hashes to administrators when an administrator edits a user's properties. Many thanks to Gerhard Klostermeier (syss.de) for the report.
+
+
fixes
+
+
Fix crash in Gitblit Authority when users were deleted from Gitblit but still had entries (certificates) in the Authority. (issue 1359, pull request #1435)
+
Fix tab-to-space conversion to work like tabs. (pull request #1065 by @QuentinC)
+
Fix user effective permission display when user is in multiple groups with different permissions. (pull request #1100 by @felazuris)
Replaced old Flash-based Clippy copy-paste buttons to copy repository URLs and other text to the clipboard with a modern JavaScript-based approach via clipboard.js. (issue 1241, issue 965, pull request #1438 by @flaix)
+
Updated various dependencies that had known CVEs.
+
Updated Git clients list on empty repository page.
+
Improved Chinese translation of "fork".
+
Switched logging library from Log4j1 to reload4j.
+
Updating the BouncyCastle version required to switch from bc*-jdk15on to bc*-jdk18on
* Support for ECDSA and Ed25519 SSH keys * Fix vulnerability that allowed SSH authentication to be circumvented * Explicitly disable requesting optional client TLS certificates * Copy-to-clipboard button is back and working * Minimal required Java version is Java 8
While old DSA SSH host keys can still be used, a new Gitblit installation will no longer generate a DSA host key. The default set of host keys is now RSA, ECDSA and Ed25519.
Snapshot builds of the current master branch are now available as Docker containers on Docker Hub under the "Nightly" tag.
+
+
+
Note
+ This release fixes a vulnerability allowing an attacker to circumvent authentication on the SSH transport. Users are urged to update to this version.Should you have disabled the Flash-based copy-to-clipboard function because it wasn't working anymore (`web.allowFlashCopyToClipboard = false`), you may want to rethink this and enable it again. The configuration property has the same name, but the mechanism was exchanged. Flash is gone, and a modern JavaScript solution is now used to copy text directly to the clipboard (via clipboard.js).The setting `server.requireClientCertificates` now has three values: `required`, `optional` and `none`. While `required` is synonymous to the old `true` value, and `optional` is synonymous to the old `false` value, the new `none` value results in the server never asking the client to present any client certificate at all. The old values `true` and `false` can still be used and keep their meaning.From 1.10.0 on Gitblit requires Java 8 as minimal Java version.
+
+
+
security
+
+
Fix path traversal vulnerability which allowed access to "/resources//../WEB-INF/". (CVE-2022-31268) This was fixed by updating Jetty. (issue 1409)
+
Fix exploit circumventing SSH authentication. Many thanks to András Veres-Szentkirályi (silentsignal.eu) for the report. (CVE-2024-28080)
+
Fix vulnerability exposing user password hashes to administrators when an administrator edits a user's properties. Many thanks to Gerhard Klostermeier (syss.de) for the report.
+
+
fixes
+
+
Fix crash in Gitblit Authority when users were deleted from Gitblit but still had entries (certificates) in the Authority. (issue 1359, pull request #1435)
+
Fix tab-to-space conversion to work like tabs. (pull request #1065 by @QuentinC)
+
Fix user effective permission display when user is in multiple groups with different permissions. (pull request #1100 by @felazuris)
Replaced old Flash-based Clippy copy-paste buttons to copy repository URLs and other text to the clipboard with a modern JavaScript-based approach via clipboard.js. (issue 1241, issue 965, pull request #1438 by @flaix)
+
Updated various dependencies that had known CVEs.
+
Updated Git clients list on empty repository page.
+
Improved Chinese translation of "fork".
+
Switched logging library from Log4j1 to reload4j.
+
Updating the BouncyCastle version required to switch from bc*-jdk15on to bc*-jdk18on
!! IMPORTANT SECURITY FIX FOR CONFIG USER SERVICE !!
There is a security vulnerability in version 1.9.2, which allows an attacker to gain elevated access rights. This is present when the Config User Service is used as the user service, which is the default.
Version 1.9.2 introduced a new implementation to store user data in the user config file which holds user name, password, access rights etc. This was done to solve problems with very large user bases (pull request #1364). This new implementation does not properly escape all control characters, like newline and tab. As a result, a normal user, when logged into Gitblit, can edit his profile data and enter values in e.g. the email address that are interpreted as control characters in the text file stored on disk. This allows the malicious user to give themselves e.g. elevated access rights on their account.
This is fixed in 1.9.3. Updates of existing installations should be made to 1.9.3, not 1.9.2.
Many thanks to Github user @YYHYlh for finding and reporting this issue (issue 1410).
+
+
+
Note
+ The 1.9 minor version is the last to support Java 7. From 1.10 on Gitblit will require Java 8.
+
+
+
security
+
+
Fix escaping control characters in config user service, resolving a security vulnerability. (issue 1410)
There is a severe bug in version 1.9.0, which can lock users out from their accounts. When updating from a previous version to 1.9.0, existing stored passwords are rehashed with a more secure password hash mechanism when a user first logs in after the update. This happens when the password hashing mechanism was left at default and not specifically set in the configuration. An error in the implementation will destroy the stored password instead and the user can no longer log in.
Only certain circumstances will lead to this wrong behaviour. It will most likely affect users of the Gitblit Docker container. If you did not encounter any problems, update to 1.9.1 to be on the safe side. If you were hit by this bug, we are deeply sorry. There is no way to fix the affected accounts other than to set a new password.
This is fixed in 1.9.1. Updates of existing installations should be made to 1.9.1, not 1.9.0.
+
+
+
Note
+ When you have Gitblit installed as a service under Linux or Windows, you may need to edit your service script/definition. The command line to start Gitblit needs to be different, the classpath and class are specified now.See notes for release 1.9.0.
+
* Collapsible and nested repository groups on the repositories page * Runs on Java 11 * Retrieve SSH keys from LDAP * User language preference * Option to merge ticket branches fast-forward or with merge commit
+
+
+
Note
+ Gitblit uses Servlet 3.0 and thus drops support for Tomcat 6. Run on Tomcat 6 at your own risk. With the update to Lucene 5.5.2 reindexing of the tickets is necessary. This is done automatically during the first server start after an upgrade. Depending on the amount of tickets you have, this could take a little while. The old index is kept, so that a downgrade is still possible without losing information. The old index can be deleted, when a downgrade is no longer required.The interface for the ITicketService changed. If you have your own derived implementation, rename `start` to `onStart`. (see commit 63dbdfda)To support Java 9+, Gitblit can no longer load JARs from the 'ext' folder by itself. In order to include the folder, it needs to be added to the classpath explicitly by changing the command line. Check the new start scripts to see the new required command line.The 1.9 minor version will be the last to support Java 7. From 1.10 on Gitblit will require Java 8.When the `realm.ldap.bindpattern` property is set, GitBlit will only bind as the user to LDAP, not to a manager account or anonymously.Older password storage mechanisms are deprecated, PBKDF2 is the new default. When you switch from plaintext to a hashed scheme, or from the older hashed to the new PBKDF2 scheme, the stored password of a user will be rehashed with the more secure mechanism when the user logs in.!! THIS IS BROKEN IN 1.9.0. DO NOT UPDATE TO 1.9.0. USE 1.9.1 INSTEAD !!
+
* Dependency updates * Many bug fixes * GITBLIT_HOME environment variable support
+
+
+
Note
+ The next major release (v1.7.0) will focus on:* ticket 75: making projects more useful including the concept of project ownershipThis improvement will require a NON-BACKWARDS-COMPATIBLE migration of repository ownership from the RepositoryModel to the UserModel* ticket 55: facilitating usage of tickets & git-flow in the web ui
+
+
+
security
+
+
Sanitize page parameters, form fields, and markup for XSS vulnerabilities (issue 792, ticket 164)
* My Tickets page * User Preferences web ui * SSH key management web ui * Basic CRUD pages for ticket milestones * Overhaul repository creation, editing, and empty repository pages
If you are upgrading, you might consider copying the data/gitignore folder to your ${baseFolder} to allow selection & injection of a .gitignore when creating a repository.
The OpenShift Express build has been dropped. You can deploy GO or WAR on Express so this build is no longer necessary.
+
+
+
Note
+ The next major release (v1.7.0) will focus on:* ticket 75: making projects more useful including the concept of project ownershipThis improvement will require a NON-BACKWARDS-COMPATIBLE migration of repository ownership from the RpeositoryModel to the UserModel* ticket 55: facilitating usage of tickets & git-flow in the web ui
+
+
+
fixes
+
+
Allow ticket responsible selection if anonymous push is enabled (issue 721, ticket 71)
* Integrated SSH daemon based on Apache Mina/SSHD and Gerrit * Basic plugin management framework and plugin registry, limited extension points * Replace GoogleCharts with a self-hosted copy of the flotr2 charting library * Move to Java 7, some dependencies require this * Move to Jetty 9, dropped AJP feature because it was removed upstream
+
+
+
Note
+ Gitblit now requires Java 7 for build & runtime.
+
+
+
fixes
+
+
Repository mailing lists could not be reset from the Edit Repository page (issue 695)
+
Fix intermittent NPE in determining commit date in RefModel (issue 697)
+
Fix closing ticket on push by parsing commit messages for closes|fixes (issue 700)
+
Fix diffstat display for a ticket with a pending submodule change (issue 703)
+
Ensure the Lucene ticket index is updated on repository deletion.
+
Fixed failure to properly determine hasTicket in RedisTicketService
!! IMPORTANT BUG FIX FOR EXTERNAL AUTHENTICATION (1.4.1) !!
This is a MAJOR release (1.4.0).
The entire core has been refactored to be more modular. Authentication providers have all been refactored to be simpler. Both of these were precursor requirements for landing the Tickets feature -- issue tracker & branch-based pull requests.
Markup rendering has been improved and expanded to several additional formats. A repository mirroring service has been added to allow you to automatically track public repositories. Commit pages now indicate diffstat information and many bug fixes and smaller features have been introduced.
The groundwork has also been laid for SSH support which will be in the focal point for the next major release (ticket 6).
Due to the enormity of these changes, please make a backup copy of users.conf before updating.
+
+
+
Note
+ The default access restriction has been elevated from NONE to PUSH and anonymous push access has been disabled by default.
+
+
+
security
+
+
Fix major authentication security hole when using external authentication providers (issue 683, ticket 35)
+
+
fixes
+
+
Fixed incorrect branch ref in Ticket page for symlinks (issue 679, ticket 32)
The entire core has been refactored to be more modular. Authentication providers have all been refactored to be simpler. Both of these were precursor requirements for landing the Tickets feature -- issue tracker & branch-based pull requests.
Markup rendering has been improved and expanded to several additional formats. A repository mirroring service has been added to allow you to automatically track public repositories. Commit pages now indicate diffstat information and many bug fixes and smaller features have been introduced.
The groundwork has also been laid for SSH support which will be in the focal point for the next major release (ticket 6).
Due to the enormity of these changes, please make a backup copy of users.conf before updating.
+
+
+
Note
+ The default access restriction has been elevated from NONE to PUSH and anonymous push access has been disabled by default.
+
+
+
security
+
+
issue 657: Cookies were not reset on administrative password change of a user account. This allowed accounts with changed passwords to continue authenticating. Cookies are now reset on password changes, they are validated on each page request, AND they will now expire 7 days after generation.
+
+
fixes
+
+
Fixed incorrect tagger attribution in the dashboard (issue 572)
+
Fixed support for implied SSH urls in web.otherUrls (issue 607)
+
Fixed injection of unnecessary explicit CLONE permissions for a fork when users or teams already had implied regex permissions (issue 616)
+
Bind LDAP connection after establishing TLS initialization (issue 639)
+
Fixed NPE when attempting to add a permission without a registrant (issue 640)
+
Invalidate all cached repository data on "clear cache" (issue 642)
Added an optional MirrorService which will periodically fetch ref updates from source repositories for mirrors (issue 301). Repositories must be manually cloned using native git and "--mirror".
+
Added branch graph image servlet based on EGit's branch graph renderer (issue 490)
+
Added option to render Markdown commit messages (issue 499)
+
Added Ticket tracker and Patchset collaboration feature (issue 511)
+
Added setting to control creating a repository as --shared on Unix servers (issue 559)
+
Set Link: <url>; rel="canonical" http header for SEO (issue 600)
+
Added raw links to the commit, commitdiff, and compare pages (issue 615)
+
Support intradocument linking in Markdown content using [[WikiLinks]] syntax (issue 620)
+
Support Markdown image links relative to the repository root (issue 620)
+ If you have forked repositories and your are upgrading from 1.2.x to 1.3.x, please DO NOT RELOCATE your repositories folder when running 1.3.x the first time. Gitblit will update forked repository configs on the first execution and it is critical that ${git.repositoriesFolder} points to the same location used by 1.2.x.
+
+
+
fixes
+
+
Gitblit-as-viewer with no repository urls failed to display summary page (issue 565)
+
Fixed incorrect tagger in the dashboard pages (issue 572)
+
Automatically decode %7E in repository names from git clients that encode ~ (issue 574)
+
Fixed missing Keys class in WAR and Express builds
+
Fixed missing model class dependencies in Gitblit Manager build
+
Fix for IE10 compatibility mode
+
Reset dashboard and activity commit cache on branch REWIND or DELETE
+
Fixed bug with adding new local users with external authentication
+
Fixed missing clone url on the empty repository page
+
Fixed Ubuntu service script for LSB compliance
+
Inserted "sleep 5" in Ubuntu & Centos bash script for service restart
+
+
changes
+
+
Use trash icon in Gitblit Reflog for branch and tag deletion
+
Update Gitblit Reflog on branch deletion from web UI
+
Updated Chinese translation
+
Updated Dutch translation
+
Updated Spanish translation
+
Updated Korean translation
+
Updated Brazilian Portuguese translation
+
+
additions
+
+
Added optional browser-side page caching using Last-Modified and Cache-Control for the dashboard, activity, project, and several repository pages (issue 570)
+
Added a GET_USER request type for the RPC mechanism (issue 571)
+
Added PAMUserService to authenticate against a local Linux/Unix/MacOSX server
completed the Gitblit reflog (formerly pushlog) introduced in 1.2.1
+
added new dashboard pages
+
added a stars feature
+
improved the repository url panel to show your access permission and to offer native app clone links
+
improved navigation and theme
+
customizable page header colors and logo
+
recent activity commit caching to improve performance of dashboard and activity pages
+
Windows authentication
+
Salesforce.com authentication
+
lots of bug fixes
+
+
+Thank you to syntevo, Atlassian, fournova, and Github for their permission and use of their artwork for the native app clone menus.
+
+
+
+
+
Note
+ If you have forked repositories and your are upgrading to 1.3.0, please DO NOT RELOCATE your repositories folder when running 1.3.0 the first time. Gitblit will update forked repository configs on the first execution and it is critical that ${git.repositoriesFolder} points to the same location used by 1.2.x.
+
+
+
security
+
+
Raw servlet was insecure. If someone knew the exact repository name and path to a file, the raw blob could be retrieved bypassing security constraints. (issue 494)
+
+
fixes
+
+
Use bash instead of sh in Linux/OSX shell scripts (issue 450)
+
Fix NPE when getting user's fork without repository list caching (issue 478)
+
Fix internal error on folder history links (issue 488)
+
Fix NPE in repositories panel when viewing a federation proposal (issue 491)
+
Fix NPEs when initializing the context on a servlet containers which returns a null contextFolder (issue 495)
+
Fixed incorrect icon file name for .doc files (issue 496)
+
Do not queue emails with no recipients (issue 497)
+
Disable view and blame links for deleted blobs (issue 512)
+
Fixed 1.2.x regression with individually symlinked repositories (issue 513)
+
Fixed UTF-8 encoding errors in email notifications (issue 514)
Improve NPE handling for hook script enumeration (issue 549)
+
Workaround missing commit information in blame page (JGit bug 374382, issue 550)
+
Ignore orphan ".git" folder in the repositories root folder (issue 552)
+
Fixed bug where a null permission was added to a user model on a repository rename when the permission had really been inherited from a team membership (issue 555)
+
Fixed committer verification with merge commits (issue 560)
+
Fixed bug in submodule repository linking (issue 562)
+
Could not reset settings with $ or { characters through Gitblit Manager because they are not properly escaped
+
Added more error checking to blob page and blame page
+
Disable SNI extensions for client SSL connections
+
Fixed prettify language extension loading
+
Fixed index out of bounds exceptions when generating client certificates for a user when the user's table has been filtered
+
Fixed AddindexedBranch tool when specifying the non-default branch.
+
Fixed submodule diff display
+
+
changes
+
+
Retrieve summary and metric graphs from Google over https (issue 357)
+
Persist originRepository (for forks) in the repository config instead of relying on parsing origin urls which are susceptible to filesystem relocation (issue 486)
+
Improved error logging for servlet containers which provide a null contextFolder (issue 495)
+
Improve Gerrit change ref decoration in the refs panel (issue 502)
+
Display full commit message on commitdiff page (issue 554)
+
Improved the repository url display. This display now indicates your repository access permission, per-protocol.
+
Automatically encode/decode usernames for urls using %XX notation on space, @, and \
+
Disable Gson's pretty printing which has a huge performance gain
+
Properly set application/json content-type on api calls
+
Make days back filter choices a setting
+
Changed default days back filter setting to 7 days
+
Set rel="nofollow" on compressed download links
+
Improved page title
+
Updated Polish translation
+
Updated Japanese translation
+
+
additions
+
+
Added a ui for the ref log introduced in 1.2.1 (issue 473)
+
Added weblogic.xml to WAR for deployment on WebLogic (issue 495)
Support username substitution in web.otherUrls (issue 509)
+
Option to force client-side basic authentication instead of form-based authentication if web.authenticateViewPages=true (issue 518)
+
Set author as tooltip of last change column in the repositories panel (issue 534)
+
Setting to automatically create an user account based on an authenticated user principal from the servlet container (issue 542)
+
Added WindowsUserService to authenticate users against Windows accounts (issue 546)
+
Global and per-repository setting to exclude authors from metrics (issue 547)
+
Added commit cache to improve Activity, Dashboard, and Project page generation times
+
Added SalesForce.com user service
+
Added simple star/unstar function to flag or bookmark interesting repositories
+
Added Dashboard page which shows a news feed for starred repositories and offers a filterable list of repositories you care about
+
Added client application menus for Git, SmartGit/Hg, SourceTree, Tower, GitHub for Windows, and GitHub for Mac
+
Added GO http/https connector thread pool size setting
+
Added a server setting to force a particular translation/Locale for all sessions
+
Added smart Git Daemon serving. If enabled, git:// access will be offered for any repository which permits anonymous access. If the repository permits anonymous cloning, anonymous git:// clone will be permitted while anonmymous git:// pushes will be rejected.
+
Option to automatically tag branch tips on each push with an incremental revision number
+
Implemented multiple repository owners
+
Optional periodic LDAP user and team pre-fetching & synchronization
+
Added config setting to use SMTPS
+
Added option to index all local branches in AddIndexedBranches tool
+
Display name and version in Tomcat Manager
+
FogBugz post-receive hook script
+
Chinese translation
+
Support --baseFolder parameter in Federation Client
Because there are now several types of files and folders that must be considered Gitblit data, the default location for data has changed.
+
+You will need to move a few files around when upgrading. Please review the upgrading GO or upgrading WAR page for details.
+
+Express Users make sure to update your web.xml file with the ${baseFolder} values!
+
+
+
+
+
fixes
+
+
Fixed nullpointer on recursively calculating folder sizes when there is a named pipe or symlink in the hierarchy
+
Added nullchecking when concurrently forking a repository and trying to display the fork network (issue 483)
+
Fixed bug where permission changes were not visible in the web ui to a logged-in user until the user logged-out and then logged back in again (issue 482)
+
Fixed nullpointer on creating a repository with mixed case (issue 481)
+
Include missing model classes in api library (issue 480)
+
Fixed nullpointer when using *web.allowForking = true* && *git.cacheRepositoryList = false* (issue 478)
+
Likely fix for commit and commitdiff page failures when a submodule reference changes (issue 474)
+
Build project models from the repository model cache, when possible, to reduce page load time (issue 468)
+
Fixed loading of Brazilian Portuguese translation from *nix server
+
+
changes
+
+
Gitblit GO and Gitblit WAR are now both configured by `gitblit.properties`. WAR is no longer configured by `web.xml`. However, Express for OpenShift continues to be configured by `web.xml`.
+
Support for a *--baseFolder* command-line argument for Gitblit GO and Gitblit Certificate Authority
+
Support for specifying a *${baseFolder}* parameter in `gitblit.properties` and `web.xml` for several settings
+
Improve history display of a submodule link
+
Updated Korean translation
+
Updated checkstyle definition
+
+
additions
+
+
Fanout PubSub service for self-hosted [Sparkleshare](http://sparkleshare.org) notifications. This service is disabled by default.
+
Implemented a simple push log based on a hidden, orphan branch refs/gitblit/pushes (issue 473) The push log is not currently visible in the ui, but the data will be collected and it will be exposed to the ui in the next release.
+
Support for locally and remotely authenticated accounts in LdapUserService and RedmineUserService (issue 479)
+ The permissions model has changed in the 1.2.0 release.If you are updating your server, you must also update any Gitblit Manager and Federation Client installs to 1.2.0 as well. The data model used by the RPC mechanism has changed slightly for the new permissions infrastructure.
+
Fixed bug where repository ownership was not updated on rename user
+
Fixed bug in create/rename repository if you explicitly specified the alias for the root group (e.g. main/myrepo) (issue 439)
+
Wrapped Markdown parser with improved exception handler (issue 438)
+
Fixed duplicate entries in repository cache (issue 436)
+
Fixed connection leak in LDAPUserService (issue 435)
+
Fixed bug in commit page where changes to a submodule threw a null pointer exception (issue 428)
+
Fixed bug in the diff view for filenames that have non-ASCII characters (issue 424)
+
+
changes
+
+
Added server setting to specify keystore alias for ssl certificate (issue 394)
+
Added optional global and per-repository activity page commit contribution throttle to help tame *really* active repositories (issue 469)
+
Added support for symlinks in tree page and commit page (issue 467)
+
All access restricted servlets (e.g. DownloadZip, RSS, etc) will try to authenticate using X509 certificates, container principals, cookies, and BASIC headers, in that order.
+
Added *groovy* and *scala* to *web.prettyPrintExtensions*
+
Added short commit id column to log and history tables (issue 464)
+
Teams can now specify the *admin*, *create*, and *fork* roles to simplify user administration
+
Use https Gravatar urls to avoid browser complaints
+
Added frm to default pretty print extensions (issue 452)
+
Expose ReceivePack to Groovy push hooks (issue 421)
+
Redirect to summary page when refreshing the empty repository page on a repository that is not empty (issue 425)
+
Emit a warning in the log file if running on a Tomcat-based servlet container which is unfriendly to %2F forward-slash url encoding AND Gitblit is configured to mount parameters with %2F forward-slash url encoding (issue 422)
+
LDAP admin attribute setting is now consistent with LDAP teams setting and admin teams list. If *realm.ldap.maintainTeams==true* **AND** *realm.ldap.admins* is not empty, then User.canAdmin() is controlled by LDAP administrative team membership. Otherwise, User.canAdmin() is controlled by Gitblit.
+
Support servlet container authentication for existing UserModels (issue 364)
- V (view in web ui, RSS feeds, download zip) - R (clone) - RW (clone and push) - RWC (clone and push with ref creation) - RWD (clone and push with ref creation, deletion) - RW+ (clone and push with ref creation, deletion, rewind)
While not as sophisticated as Gitolite, this does give finer access controls. These permissions fit in cleanly with the existing users.conf and users.properties files. In Gitblit <= 1.1.0, all your existing user accounts have RW+ access. If you are upgrading to 1.2.0, the RW+ access is *preserved* and you will have to lower/adjust accordingly.
+
Implemented *case-insensitive* regex repository permission matching (issue 332) This allows you to specify a permission like `RW:mygroup/.*` to grant push privileges to all repositories within the *mygroup* project/folder.
+
Added DELETE, CREATE, and NON-FAST-FORWARD ref change logging
+
Added support for personal repositories. Personal repositories can be created by accounts with the *create* permission and are stored in *git.repositoriesFolder/~username*. Each user with personal repositories will have a user page, something like the GitHub profile page. Personal repositories have all the same features as common repositories, except personal repositories can be renamed by their owner.
+
Added support for server-side forking of a repository to a personal repository (issue 433) In order to fork a repository, the user account must have the *fork* permission **and** the repository must *allow forks*. The clone inherits the access list of its origin. i.e. if Team A has clone access to the origin repository, then by default Team A also has clone access to the fork. This is to facilitate collaboration. The fork owner may change access to the fork and add/remove users/teams, etc as required <u>however</u> it should be noted that all personal forks will be enumerated in the fork network regardless of access view restrictions. If you really must have an invisible fork, the clone it locally, create a new repository for your invisible fork, and push it back to Gitblit.
+
Added optional *create-on-push* support
+
Added **experimental** JGit-based garbage collection service. This service is disabled by default.
+
Added support for X509 client certificate authentication. (issue 402) You can require all git servlet access be authenticated by a client certificate. You may also specify the OID fingerprint to use for mapping a certificate to a username. It should be noted that the user account MUST already exist in Gitblit for this authentication mechanism to work; this mechanism can not be used to automatically create user accounts from a certificate.
+
Revised clean install certificate generation to create a Gitblit GO Certificate Authority certificate; an SSL certificate signed by the CA certificate; and to create distinct server key and server trust stores. <u>The store files have been renamed!</u>
+
Added support for Gitblit GO to require usage of client certificates to access the entire server.
+
Added **Gitblit Certificate Authority**, an x509 PKI management tool for Gitblit GO to encourage use of x509 client certificate authentication.
+
Added web.shortCommitId setting to control length of shortened commit ids
+ If you are updating from an earlier release AND you have indexed branches with the Lucene indexing feature, you need to be aware that this release will completely re-index your repositories. Please be sure to provide ample heap resources as appropriate for your installation.
+
+
+
fixes
+
+
Bypass Wicket's inability to handle direct url addressing of a view-restricted, grouped repository for new, unauthenticated sessions (e.g. click link from email or rss feed without having an active Wicket session)
+
Fixed MailExecutor's failure to cope with mail server connection troubles resulting in 100% CPU usage
+
Fixed generated urls in Groovy *sendmail* hook script for grouped repositories
+
Fixed generated urls in RSS feeds for grouped repositories
+
Fixed nullpointer exception in git servlet security filter (issue 419)
+
Eliminated an unnecessary repository enumeration call on the root page which should result in faster page loads (issue 399)
+
Gitblit could not delete a Lucene index in a working copy on index upgrade
Restore original user or team object on failure to update (issue 414)
+
Fixes to relative path determination in repository search algorithm for symlinks (issue 412)
+
Fix to GitServlet to allow pushing to symlinked repositories (issue 412)
+
Repository URL now uses `X-Forwarded-Proto` and `X-Forwarded-Port`, if available, for reverse proxy configurations (issue 411)
+
Output real RAW content, not simulated RAW content (issue 410)
+
Fixed Lucene charset encoding bug when reindexing a repository (issue 408)
+
Fixed search box linking to Lucene page for grouped repository on Tomcat (issue 407)
+
Fixed null pointer in LdapUserSerivce if account has a null email address (issue 406)
+
Really fixed failure to update a GO setting from the manager (issue 381)
+
+
changes
+
+
Line breaks inserted for readability in raw Markdown content display in the event of a parsing/transformation error. An error message is now displayed prepended to the raw content.
+
Improve UTF-8 reading for Markdown files
+
Updated Polish translation
+
Updated Japanese translation
+
Updated Spanish translation
+
+
additions
+
+
Identified repository list is now cached by default to reduce disk io and to improve performance (issue 399)
+
Preliminary bare repository submodule support
+
*git.submoduleUrlPatterns* is a space-delimited list of regular expressions for extracting a repository name from a submodule url. For example, `git.submoduleUrlPatterns = .*?://github.com/(.*)` would extract *gitblit/gitblit.git* from *git://github.git/gitblit/gitblit.git* **Note:** You may not need this control to work with submodules, but it is there if you do. - If there are no matches from *git.submoduleUrlPatterns* then the repository name is assumed to be whatever comes after the last `/` character *(e.g. gitblit.git)* - Gitblit will try to locate this repository relative to the current repository *(e.g. myfolder/myrepo.git, myfolder/mysubmodule.git)* and then at the root level *(mysubmodule.git)* if that fails. - Submodule references in a working copy will be properly identified as gitlinks, but Gitblit will not traverse into the working copy submodule repository.
+
Added a repository setting to control authorization as AUTHENTICATED or NAMED. (issue 413)
NAMED is the original behavior for authorizing against a list of permitted users or permitted teams. AUTHENTICATED allows restricted access for any authenticated user. This is a looser authorization control.
+
Added default authorization control setting (AUTHENTICATED or NAMED)
+
Added setting to control how deep Gitblit will recurse into *git.repositoriesFolder* looking for repositories (issue 399)
+
Added setting to specify regex exclusions for repositories (issue 399)
+
Blob page now supports displaying images (issue 302)
+
Non-image binary files can now be downloaded using the RAW link
Fixed bug in Lucene search where old/stale blobs were never properly deleted during incremental updates. This resulted in duplicate blob entries in the index.
+
Fixed intermittent bug in identifying line numbers in Lucene search (issue 401)
+
Adjust repository identification algorithm to handle the scenario where a repository name collides with a group/folder name (e.g. foo.git and foo/bar.git) (issue 400)
+
Fixed bug where a repository set as *authenticated push* did not have anonymous clone access (issue 392)
+
Fixed bug in Basic authentication if passwords had a colon
+
Fixed bug where the Gitblit Manager could not update a setting that was not referenced in reference.properties (issue 381)
+
+
changes
+
+
**Updated Lucene index version which will force a rebuild of ALL your Lucene indexes** Make sure to properly set *web.blobEncodings* before starting Gitblit if you are updating! (issue 393)
+
Changed default layout for web ui from Fixed-Width layout to Responsive layout (issue 397)
+
IUserService interface has changed to better accomodate custom authentication and/or custom authorization. The default `users.conf` now supports persisting display names and email addresses.
+
Updated Japanese translation
+
+
additions
+
+
Added setting to allow specification of a robots.txt file (issue 395)
+
Added setting to control Responsive layout or Fixed-Width layout (issue 397) Responsive layout is now the default. This layout gracefully scales the web ui from a desktop layout to a mobile layout by hiding page components. It is easy to try, just resize your browser or point your Android/iOS device to the url of your Gitblit install.
+
Added setting to control charsets for blob string decoding. Default encodings are UTF-8, ISO-8859-1, and the server default charset. (issue 393)
+
Exposed JGit internal configuration settings in gitblit.properties/web.xml (issue 389) Review your `gitblit.properties` or `web.xml` for detailed explanations of these settings.
+
Added default access restriction. Applies to new repositories and repositories that have not been configured with Gitblit. (issue 384)
+
Added Ivy 2.2.0 dependency which enables Groovy Grapes, a mechanism to resolve and retrieve library dependencies from a Maven 2 repository within a Groovy push hook script
+
Added setting to control Groovy Grape root folder (location where resolved dependencies are stored) [Grape](http://groovy.codehaus.org/Grape) allows you to add Maven dependencies to your pre-/post-receive hook script classpath.
+
Added LDAP User Service with many new *realm.ldap* keys
+
Added support for custom repository properties for Groovy hooks Custom repository properties complement hook scripts by providing text field prompts in the web ui and the Gitblit Manager for the defined properties. This allows your push hooks to be parameterized.
+
Added script to facilitate proxy environment setup on Linux
Fixed bug where you could not remove all selections from a RepositoryModel list (permitted users, permitted teams, hook scripts, federation sets, etc) (issue 377)
+
Automatically set *java.awt.headless=true* for Gitblit GO
Disregard searching a subfolder if Gitblit does not have filesystem permissions (issue 347)
+
+
changes
+
+
Reject pushes to a repository with a working copy (i.e. non-bare repository) (issue 345)
+
Changed default web.datetimestampLongFormat from *EEEE, MMMM d, yyyy h:mm a z* to *EEEE, MMMM d, yyyy HH:mm Z* (issue 346)
+
Expanded commit age coloring from 2 days to 30 days (issue 353)
+
+
additions
+
+
Added optional Lucene branch indexing (issue 312) Repository branches may be optionally indexed by Lucene for improved searching. To use this feature you must specify which branches to index within the *Edit Repository* page; _no repositories are automatically indexed_. Gitblit will build or incrementally update enrolled repositories on a 2 minute cycle. (i.e you will have to wait 2-3 minutes after respecifying indexed branches or pushing new commits before Gitblit will build/update the repository Lucene index.) If a repository has Lucene-indexed branches the *search* form on the repository pages will redirect to the root-level Lucene search page and only the content of those branches can be searched.<br/> If the repository does not specify any indexed branches then repository commit-traversal search is used.
**Note:** Initial indexing of an existing repository can be memory-exhaustive. Be sure to provide your Gitblit server adequate heap space to index your repositories (e.g. -Xmx1024M).<br/> See the [setup](setup.html) page for additional details.
+
Allow specifying timezone to use for Gitblit which is independent of both the JVM and the system timezone (issue 350)
+
Added a built-in AJP connector for integrating Gitblit GO into an Apache mod_proxy setup (issue 355)
+
On the Repositories page show a bang *!* character in the color swatch of a repository with a working copy (issue 345) Push requests to these repositories will be rejected.
+
On all non-bare Repository pages show *WORKING COPY* in the upper right corner (issue 345)
+
New setting to prevent display/serving non-bare repositories
+
Added *protect-refs.groovy*
+
Allow setting default branch (relinking HEAD) to a branch or a tag
Several a bugs in FileUserService related to cleaning up old repository permissions on a rename or delete
+
Renaming a repository into a new subfolder failed (issue 329)
+
+
changes
+
+
Dropped display of trailing .git from repository names
+
Gitblit GO is now monolithic like the WAR build. (issue 326) This change helps adoption of GO in environments without an internet connection or with a restricted connection.
+
Unit testing framework has been migrated to JUnit4 syntax and the test suite has been redesigned to run all unit tests, including rpc, federation, and git push/clone tests
+
+
additions
+
+
Platform-independent, Groovy push hook script mechanism. Hook scripts can be set per-repository, per-team, or globally for all repositories.
+
*sendmail.groovy* for optional email notifications on push. You must properly configure your SMTP server settings in `gitblit.properties` or `web.xml` to use *sendmail.groovy*.
+
New global key for mailing lists. This is used in conjunction with the *sendmail.groovy* hook script. All repositories that use the *sendmail.groovy* script will include these addresses in the notification process. Please see the Setup page for more details about configuring sendmail.
+
*com.gitblit.GitblitUserService*. This is a wrapper object for the built-in user service implementations. For those wanting to only implement custom authentication it is recommended to subclass GitblitUserService and override the appropriate methods. Going forward, this will help insulate custom authentication from new IUserService API and/or changes in model classes.
+
New default user service implementation: *com.gitblit.ConfigUserService* (`users.conf`) This user service implementation allows for serialization and deserialization of more sophisticated Gitblit User objects without requiring the encoding trickery now present in FileUserService (users.properties). This will open the door for more advanced Gitblit features. For those upgrading from an earlier Gitblit version, a `users.conf` file will automatically be created for you from your existing `users.properties` file on your first launch of Gitblit <u>however</u> you will have to manually set *realm.userService=users.conf* to switch to the new user service. The original `users.properties` file and the corresponding implementation are **deprecated**.
+
Teams for specifying user-repository access in bulk. Teams may also specify mailing lists addresses and pre- & post- receive hook scripts.
+
Gravatar integration
+
Activity page for aggregated repository activity. This is a timeline of commit activity over the last N days for one or more repositories.
+
*Filters* menu for the Repositories page and Activity page. You can filter by federation set, team, and simple custom regular expressions. Custom expressions can be stored in `gitblit.properties` or `web.xml` or directly defined in your url (issue 323)
+
Flash-based 1-step *copy to clipboard* of the primary repository url based on Clippy
+
JavaScript-based 3-step (click, ctrl+c, enter) *copy to clipboard* of the primary repository url in the event that you do not want to use Flash on your installation
+
Empty repositories now link to an *empty repository* page which gives some direction to the user for the next step in using Gitblit. This page displays the primary push/clone url of the repository and gives sample syntax for the git command-line client. (issue 327)
+
Repositories with a *gh-pages* branch will now have a *pages* link which will serve the content of this branch. All resource requests are against the repository, Gitblit does not checkout/export this branch to a temporary filesystem. Jekyll templating is not supported.
+
Gitblit Express bundle to get started running Gitblit on RedHat OpenShift cloud <span class="label label-warning">BETA</span>
fixed security hole when cloning clone-restricted repository with TortoiseGit (issue 324)
+
+
fixes
+
+
federation protocol timestamps. dates are now serialized to the [iso8601](http://en.wikipedia.org/wiki/ISO_8601) standard. **This breaks 0.6.0 federation clients/servers.**
+
collision on rename for repositories and users
+
Gitblit can now browse the Linux kernel repository (issue 321)
+
Gitblit now runs on Servlet 3.0 webservers (e.g. Tomcat 7, Jetty 8) (issue 319)
+
Set the RSS content type of syndication feeds for Firefox 4 (issue 318)
+
RSS feeds are now properly encoded to UTF-8
+
RSS feeds now properly generate parameterized links if *web.mountParameters=false*
+
Null pointer exception if did not set federation strategy (issue 316)
+
Gitblit GO allows SSL renegotiation if running on Java 1.6.0_22 or later
+
+
changes
+
+
updated ui with Twitter Bootstrap CSS toolkit
+
repositories list performance by caching repository sizes (issue 323)
+
summary page performance by caching metric calculations (issue 321)
+
+
additions
+
+
authenticated JSON RPC mechanism
+
Gitblit API RSS/JSON RPC library
+
Gitblit Manager (Java/Swing Application) for remote administration of a Gitblit server.
+
per-repository setting to skip size calculation (faster repositories page loading)
federation feature to allow gitblit instances (or gitblit federation clients) to pull repositories and, optionally, settings and accounts from other gitblit instances. This is something like [svn-sync](http://svnbook.red-bean.com/en/1.5/svn.ref.svnsync.html) for gitblit.
+
user role *#notfederated* to prevent a user account from being pulled by a federated Gitblit instance
completed the Gitblit reflog (formerly pushlog) introduced in 1.2.1
-
added new dashboard pages
-
added a stars feature
-
improved the repository url panel to show your access permission and to offer native app clone links
-
improved navigation and theme
-
customizable page header colors and logo
-
recent activity commit caching to improve performance of dashboard and activity pages
-
Windows authentication
-
Salesforce.com authentication
-
lots of bug fixes
-
-
- Thank you to syntevo, Atlassian, fournova, and Github for their permission and use of their artwork for the native app clone menus.
- ''
- note: ''
- If you have forked repositories and your are upgrading to 1.3.0, please DO NOT RELOCATE your repositories folder when running 1.3.0 the first time. Gitblit will update forked repository configs on the first execution and it is critical that ${git.repositoriesFolder} points to the same location used by 1.2.x.
- ''
- security:
- - Raw servlet was insecure. If someone knew the exact repository name and path to a file, the raw blob could be retrieved bypassing security constraints. (issue 494)
- fixes:
- - Use bash instead of sh in Linux/OSX shell scripts (issue 450)
- - Fix NPE when getting user's fork without repository list caching (issue 478)
- - Fix internal error on folder history links (issue 488)
- - Fix NPE in repositories panel when viewing a federation proposal (issue 491)
- - Fix NPEs when initializing the context on a servlet containers which returns a null contextFolder (issue 495)
- - Fixed incorrect icon file name for .doc files (issue 496)
- - Do not queue emails with no recipients (issue 497)
- - Disable view and blame links for deleted blobs (issue 512)
- - Fixed 1.2.x regression with individually symlinked repositories (issue 513)
- - Fixed UTF-8 encoding errors in email notifications (issue 514)
- - Fixed NPE in 1.2.1 Federation Client (issue 515)
- - Fixed extracting Groovy scripts on Express installs (issue 516)
- - Ensure Redmine url is properly formatted (issue 519)
- - Use standard ServletRequestWrapper instead of custom wrapper (issue 520)
- - Switch commit message back to a pre and ensure that it is properly escaped when combined with commit message regex substitution (issue 538)
- - Fixed AddIndexedBranch tool --branch parameter (issue 543)
- - Improve NPE handling for hook script enumeration (issue-549)
- - Workaround missing commit information in blame page (JGit bug 374382, issue-550)
- - Ignore orphan ".git" folder in the repositories root folder (issue-552)
- - Fixed bug where a null permission was added to a user model on a repository rename when the permission had really been inherited from a team membership (issue-555)
- - Fixed committer verification with merge commits (issue-560)
- - Fixed bug in submodule repository linking (issue-562)
- - Could not reset settings with $ or { characters through Gitblit Manager because they are not properly escaped
- - Added more error checking to blob page and blame page
- - Disable SNI extensions for client SSL connections
- - Fixed prettify language extension loading
- - Fixed index out of bounds exceptions when generating client certificates for a user when the user's table has been filtered
- - Fixed AddindexedBranch tool when specifying the non-default branch.
- - Fixed submodule diff display
-
- changes:
- - Retrieve summary and metric graphs from Google over https (issue-357)
- - Persist originRepository (for forks) in the repository config instead of relying on parsing origin urls which are susceptible to filesystem relocation (issue 486)
- - Improved error logging for servlet containers which provide a null contextFolder (issue 495)
- - Improve Gerrit change ref decoration in the refs panel (issue 502)
- - Display full commit message on commitdiff page (issue-554)
- - Improved the repository url display. This display now indicates your repository access permission, per-protocol.
- - Automatically encode/decode usernames for urls using %XX notation on space, @, and \
- - Disable Gson's pretty printing which has a huge performance gain
- - Properly set application/json content-type on api calls
- - Make days back filter choices a setting
- - Changed default days back filter setting to 7 days
- - Set rel="nofollow" on compressed download links
- - Improved page title
- - Updated Polish translation
- - Updated Japanese translation
-
- additions:
- - Added a ui for the ref log introduced in 1.2.1 (issue-473)
- - Added weblogic.xml to WAR for deployment on WebLogic (issue 495)
- - Support setting a custom header logo (issue 504)
- - Support header color customizations (issue 505)
- - Support username substitution in web.otherUrls (issue 509)
- - Option to force client-side basic authentication instead of form-based authentication if web.authenticateViewPages=true (issue 518)
- - Set author as tooltip of last change column in the repositories panel (issue-534)
- - Setting to automatically create an user account based on an authenticated user principal from the servlet container (issue-542)
- - Added WindowsUserService to authenticate users against Windows accounts (issue-546)
- - Global and per-repository setting to exclude authors from metrics (issue-547)
- - Added commit cache to improve Activity, Dashboard, and Project page generation times
- - Added SalesForce.com user service
- - Added simple star/unstar function to flag or bookmark interesting repositories
- - Added Dashboard page which shows a news feed for starred repositories and offers a filterable list of repositories you care about
- - Added client application menus for Git, SmartGit/Hg, SourceTree, Tower, GitHub for Windows, and GitHub for Mac
- - Added GO http/https connector thread pool size setting
- - Added a server setting to force a particular translation/Locale for all sessions
- - Added smart Git Daemon serving. If enabled, git:// access will be offered for any repository which permits anonymous access. If the repository permits anonymous cloning, anonymous git:// clone will be permitted while anonmymous git:// pushes will be rejected.
- - Option to automatically tag branch tips on each push with an incremental revision number
- - Implemented multiple repository owners
- - Optional periodic LDAP user and team pre-fetching & synchronization
- - Added config setting to use SMTPS
- - Added option to index all local branches in AddIndexedBranches tool
- - Display name and version in Tomcat Manager
- - FogBugz post-receive hook script
- - Chinese translation
- - Support --baseFolder parameter in Federation Client
-
- contributors:
- - James Moger
- - Bandarupalli Satyanarayana
- - Chad Horohoe
- - Christian Aistleitner
- - Colin Bowern
- - David Ostrovsky
- - Egbert Teeselink
- - Hige Maniya
- - Hirotaka Honma
- - Ikslawek
- - Jay Meyer
- - John Crygier
- - Kensuke Matsuzaki
- - Laurens Vrijnsen
- - Lee Grofit
- - Lukasz Jader
- - Martijn Laan
- - Matthias Bauer
- - Michael Pailloncy
- - Michael Schaefers
- - Oliver Doepner
- - Philip Boutros
- - Rafael Cavazin
- - Ryan Schneider
- - Sakurai Youhei
- - Sarah Haselbauer
- - Slawomir Bochenski
- - Stardrad Yin
- - Thomas Pummer
- - William Whittle
- - Yukihiko Sawanobori
- - github/akquinet
- - github/dapengme
-
- dependencyChanges:
- - JGit 3.0.0.201306101825-r
- - Iconic font
- - AngularJS 1.0.7
- - FreeMarker 2.3.19
- - Waffle 1.5
- - JNA 3.5.0
- - Guava 13.0.1
-
- settings:
- - { name: 'git.daemonBindInterface', defaultValue: 'localhost' }
- - { name: 'git.daemonPort', defaultValue: 0 }
- - { name: 'git.defaultIncrementalPushTagPrefix', defaultValue: 'r' }
- - { name: 'mail.smtps', defaultValue: 'false' }
- - { name: 'realm.container.autoCreateAccounts', defaultValue: 'false' }
- - { name: 'realm.salesforce.backingUserService', defaultValue: 'users.conf' }
- - { name: 'realm.salesforce.orgId', defaultValue: 0 }
- - { name: 'realm.windows.defaultDomain', defaultValue: ' ' }
- - { name: 'realm.windows.backingUserService', defaultValue: 'users.conf' }
- - { name: 'web.activityDuration', defaultValue: 7 }
- - { name: 'web.activityDurationChoices', defaultValue: '1 3 7 14 21 28' }
- - { name: 'web.activityCacheDays', defaultValue: 14 }
- - { name: 'web.allowAppCloneLinks', defaultValue: 'true' }
- - { name: 'web.forceDefaultLocale', defaultValue: ' ' }
- - { name: 'web.headerLogo', defaultValue: '${baseFolder}/logo.png' }
- - { name: 'web.headerBackgroundColor', defaultValue: ' ' }
- - { name: 'web.headerForegroundColor', defaultValue: ' ' }
- - { name: 'web.headerHoverColor', defaultValue: ' ' }
- - { name: 'web.headerBorderColor', defaultValue: ' ' }
- - { name: 'web.headerBorderFocusColor', defaultValue: ' ' }
- - { name: 'web.metricAuthorExclusions', defaultValue: ' ' }
- - { name: 'web.overviewReflogCount', defaultValue: 5 }
- - { name: 'web.reflogChangesPerPage', defaultValue: 10 }
- - { name: 'server.nioThreadPoolSize', defaultValue: 50 }
-}
-
-#
-# 1.2.1
-#
-r16: {
- title: Gitblit 1.2.1 Released
- id: 1.2.1
- date: 2013-01-15
- html: ''
- Because there are now several types of files and folders that must be considered Gitblit data, the default location for data has changed.
-
- You will need to move a few files around when upgrading. Please review the upgrading GO or upgrading WAR page for details.
-
- Express Users make sure to update your web.xml file with the ${baseFolder} values!
- ''
- fixes:
- - Fixed nullpointer on recursively calculating folder sizes when there is a named pipe or symlink in the hierarchy
- - Added nullchecking when concurrently forking a repository and trying to display the fork network (issue-483)
- - Fixed bug where permission changes were not visible in the web ui to a logged-in user until the user logged-out and then logged back in again (issue-482)
- - Fixed nullpointer on creating a repository with mixed case (issue 481)
- - Include missing model classes in api library (issue-480)
- - Fixed nullpointer when using *web.allowForking = true* && *git.cacheRepositoryList = false* (issue 478)
- - Likely fix for commit and commitdiff page failures when a submodule reference changes (issue 474)
- - Build project models from the repository model cache, when possible, to reduce page load time (issue 468)
- - Fixed loading of Brazilian Portuguese translation from *nix server
-
- additions:
- - ''Fanout PubSub service for self-hosted [Sparkleshare](http://sparkleshare.org) notifications.
- This service is disabled by default.''
- - ''Implemented a simple push log based on a hidden, orphan branch refs/gitblit/pushes (issue 473)
- The push log is not currently visible in the ui, but the data will be collected and it will be exposed to the ui in the next release.''
- - Support for locally and remotely authenticated accounts in LdapUserService and RedmineUserService (issue 479)
- - Added Dutch translation
-
- changes:
- - ''Gitblit GO and Gitblit WAR are now both configured by `gitblit.properties`. WAR is no longer configured by `web.xml`.
- However, Express for OpenShift continues to be configured by `web.xml`.''
- - Support for a *--baseFolder* command-line argument for Gitblit GO and Gitblit Certificate Authority
- - Support for specifying a *${baseFolder}* parameter in `gitblit.properties` and `web.xml` for several settings
- - Improve history display of a submodule link
- - Updated Korean translation
- - Updated checkstyle definition
-
- settings:
- - { name: fanout.bindInterface, defaultValue: localhost }
- - { name: fanout.port, defaultValue: 0 }
- - { name: fanout.useNio, defaultValue: 'true' }
- - { name: fanout.connectionLimit, defaultValue: 0 }
-
- contributors:
- - James Moger
- - github/mystygage
- - Dongsu, KIM
- - Jeroen Baten
- - github/inaiat
-}
-
-#
-# 1.2.0
-#
-r15: {
- title: Gitblit 1.2.0 Released
- id: 1.2.0
- date: 2012-12-31
- note: ''
- The permissions model has changed in the 1.2.0 release.
- If you are updating your server, you must also update any Gitblit Manager and Federation Client installs to 1.2.0 as well. The data model used by the RPC mechanism has changed slightly for the new permissions infrastructure.
- ''
- fixes:
- - Fixed regression in *isFrozen* (issue 477)
- - Author metrics can be broken by newlines in email addresses from converted repositories (issue 472)
- - Set subjectAlternativeName on generated SSL cert if CN is an ip address (issue 466)
- - Fixed incorrect links on history page for files not in the current/active commit (issue 462)
- - Empty repository page failed to handle missing repository (issue 456)
- - Fixed broken ticgit urls (issue 453)
- - Exclude submodules from zip downloads (issue 447)
- - Fixed bug where repository ownership was not updated on rename user
- - Fixed bug in create/rename repository if you explicitly specified the alias for the root group (e.g. main/myrepo) (issue 439)
- - Wrapped Markdown parser with improved exception handler (issue 438)
- - Fixed duplicate entries in repository cache (issue 436)
- - Fixed connection leak in LDAPUserService (issue 435)
- - Fixed bug in commit page where changes to a submodule threw a null pointer exception (issue 428)
- - Fixed bug in the diff view for filenames that have non-ASCII characters (issue 424)
-
- additions:
- - ''
- Implemented discrete repository permissions (issue 332)
-
- - V (view in web ui, RSS feeds, download zip)
- - R (clone)
- - RW (clone and push)
- - RWC (clone and push with ref creation)
- - RWD (clone and push with ref creation, deletion)
- - RW+ (clone and push with ref creation, deletion, rewind)
-
- While not as sophisticated as Gitolite, this does give finer access controls. These permissions fit in cleanly with the existing users.conf and users.properties files. In Gitblit <= 1.1.0, all your existing user accounts have RW+ access. If you are upgrading to 1.2.0, the RW+ access is *preserved* and you will have to lower/adjust accordingly.
- ''
- - ''Implemented *case-insensitive* regex repository permission matching (issue 332)
-
- This allows you to specify a permission like `RW:mygroup/.*` to grant push privileges to all repositories within the *mygroup* project/folder.''
- - Added DELETE, CREATE, and NON-FAST-FORWARD ref change logging
- - ''Added support for personal repositories.
- Personal repositories can be created by accounts with the *create* permission and are stored in *git.repositoriesFolder/~username*. Each user with personal repositories will have a user page, something like the GitHub profile page. Personal repositories have all the same features as common repositories, except personal repositories can be renamed by their owner.''
- - ''Added support for server-side forking of a repository to a personal repository (issue 433)
- In order to fork a repository, the user account must have the *fork* permission **and** the repository must *allow forks*. The clone inherits the access list of its origin. i.e. if Team A has clone access to the origin repository, then by default Team A also has clone access to the fork. This is to facilitate collaboration. The fork owner may change access to the fork and add/remove users/teams, etc as required however it should be noted that all personal forks will be enumerated in the fork network regardless of access view restrictions. If you really must have an invisible fork, the clone it locally, create a new repository for your invisible fork, and push it back to Gitblit.''
- - Added optional *create-on-push* support
- - Added **experimental** JGit-based garbage collection service. This service is disabled by default.
- - ''Added support for X509 client certificate authentication. (issue 402)
- You can require all git servlet access be authenticated by a client certificate. You may also specify the OID fingerprint to use for mapping a certificate to a username. It should be noted that the user account MUST already exist in Gitblit for this authentication mechanism to work; this mechanism can not be used to automatically create user accounts from a certificate.''
- - Revised clean install certificate generation to create a Gitblit GO Certificate Authority certificate; an SSL certificate signed by the CA certificate; and to create distinct server key and server trust stores. The store files have been renamed!
- - Added support for Gitblit GO to require usage of client certificates to access the entire server.
- - Added **Gitblit Certificate Authority**, an x509 PKI management tool for Gitblit GO to encourage use of x509 client certificate authentication.
- - Added web.shortCommitId setting to control length of shortened commit ids
- - Added alternate compressed download formats: tar.gz, tar.xz, tar.bzip2 (issue 470)
- - Added simple project pages. A project is a subfolder off the *git.repositoriesFolder*.
- - Added support for X-Forwarded-Context for Apache subdomain proxy configurations (issue 431)
- - Delete branch feature (issue 417)
- - Added line links to blob view (issue 426)
- - Added HTML sendmail hook script and Gitblit.sendHtmlMail method
- - Added RedmineUserService
- - Support for committer verification. Requires use of *--no-ff* when merging branches or pull requests. See setup page for details.
- - Added Brazilian Portuguese translation
-
- changes:
- - Added server setting to specify keystore alias for ssl certificate (issue 394)
- - Added optional global and per-repository activity page commit contribution throttle to help tame *really* active repositories (issue 469)
- - Added support for symlinks in tree page and commit page (issue 467)
- - All access restricted servlets (e.g. DownloadZip, RSS, etc) will try to authenticate using X509 certificates, container principals, cookies, and BASIC headers, in that order.
- - Added *groovy* and *scala* to *web.prettyPrintExtensions*
- - Added short commit id column to log and history tables (issue 464)
- - Teams can now specify the *admin*, *create*, and *fork* roles to simplify user administration
- - Use https Gravatar urls to avoid browser complaints
- - Added frm to default pretty print extensions (issue 452)
- - Expose ReceivePack to Groovy push hooks (issue 421)
- - Redirect to summary page when refreshing the empty repository page on a repository that is not empty (issue 425)
- - Emit a warning in the log file if running on a Tomcat-based servlet container which is unfriendly to %2F forward-slash url encoding AND Gitblit is configured to mount parameters with %2F forward-slash url encoding (issue 422)
- - ''LDAP admin attribute setting is now consistent with LDAP teams setting and admin teams list.
- If *realm.ldap.maintainTeams==true* **AND** *realm.ldap.admins* is not empty, then User.canAdmin() is controlled by LDAP administrative team membership. Otherwise, User.canAdmin() is controlled by Gitblit.''
- - Support servlet container authentication for existing UserModels (issue 364)
-
- settings:
- - { name: web.allowForking, defaultValue: 'true' }
- - { name: git.allowCreateOnPush, defaultValue: 'true' }
- - { name: git.allowGarbageCollection, defaultValue: 'false' }
- - { name: git.garbageCollectionHour, defaultValue: 0 }
- - { name: git.defaultGarbageCollectionThreshold, defaultValue: 500k }
- - { name: git.defaultGarbageCollectionPeriod, defaultValue: 7 days }
- - { name: git.requireClientCertificates, defaultValue: 'false' }
- - { name: git.enforceCertificateValidity, defaultValue: 'true' }
- - { name: git.certificateUsernameOIDs, defaultValue: CN }
- - { name: web.shortCommitIdLength, defaultValue: 8 }
- - { name: web.compressedDownloads, defaultValue: zip gz }
- - { name: server.requireClientCertificates, defaultValue: 'false' }
-
- dependencyChanges:
- - Jetty 7.6.8
- - JGit 2.2.0.201212191850-r
- - Groovy 1.8.8
- - Wicket 1.4.21
- - Lucene 3.6.1
- - BouncyCastle 1.47
- - MarkdownPapers 1.3.2
- - JCalendar 1.3.2
- - Commons-Compress 1.4.1
- - XZ for Java 1.0
-
- contributors:
- - James Moger
- - github/rafaelcavazin
- - github/mallowlabs
- - github/sauthieg
- - github/ajermakovics
- - github/kevinanderson1
- - github/jpyeron
-}
-
-#
-# 1.1.0
-#
-r14: {
- title: Gitblit 1.1.0 Released
- id: 1.1.0
- date: 2012-08-25
- note: If you are updating from an earlier release AND you have indexed branches with the Lucene indexing feature, you need to be aware that this release will completely re-index your repositories. Please be sure to provide ample heap resources as appropriate for your installation.
-
- fixes:
- - Bypass Wicket's inability to handle direct url addressing of a view-restricted, grouped repository for new, unauthenticated sessions (e.g. click link from email or rss feed without having an active Wicket session)
- - Fixed MailExecutor's failure to cope with mail server connection troubles resulting in 100% CPU usage
- - Fixed generated urls in Groovy *sendmail* hook script for grouped repositories
- - Fixed generated urls in RSS feeds for grouped repositories
- - Fixed nullpointer exception in git servlet security filter (issue 419)
- - Eliminated an unnecessary repository enumeration call on the root page which should result in faster page loads (issue 399)
- - Gitblit could not delete a Lucene index in a working copy on index upgrade
- - Do not index submodule links (issue 415)
- - Restore original user or team object on failure to update (issue 414)
- - Fixes to relative path determination in repository search algorithm for symlinks (issue 412)
- - Fix to GitServlet to allow pushing to symlinked repositories (issue 412)
- - Repository URL now uses `X-Forwarded-Proto` and `X-Forwarded-Port`, if available, for reverse proxy configurations (issue 411)
- - Output real RAW content, not simulated RAW content (issue 410)
- - Fixed Lucene charset encoding bug when reindexing a repository (issue 408)
- - Fixed search box linking to Lucene page for grouped repository on Tomcat (issue 407)
- - Fixed null pointer in LdapUserSerivce if account has a null email address (issue 406)
- - Really fixed failure to update a GO setting from the manager (issue 381)
-
- additions:
- - Identified repository list is now cached by default to reduce disk io and to improve performance (issue 399)
- - Preliminary bare repository submodule support
- - ''
- *git.submoduleUrlPatterns* is a space-delimited list of regular expressions for extracting a repository name from a submodule url.
- For example, `git.submoduleUrlPatterns = .*?://github.com/(.*)` would extract *gitblit/gitblit.git* from *git://github.git/gitblit/gitblit.git*
- **Note:** You may not need this control to work with submodules, but it is there if you do.
- - If there are no matches from *git.submoduleUrlPatterns* then the repository name is assumed to be whatever comes after the last `/` character *(e.g. gitblit.git)*
- - Gitblit will try to locate this repository relative to the current repository *(e.g. myfolder/myrepo.git, myfolder/mysubmodule.git)* and then at the root level *(mysubmodule.git)* if that fails.
- - Submodule references in a working copy will be properly identified as gitlinks, but Gitblit will not traverse into the working copy submodule repository.
- ''
- - ''
- Added a repository setting to control authorization as AUTHENTICATED or NAMED. (issue 413)
-
- NAMED is the original behavior for authorizing against a list of permitted users or permitted teams.
- AUTHENTICATED allows restricted access for any authenticated user. This is a looser authorization control.
- ''
- - Added default authorization control setting (AUTHENTICATED or NAMED)
- - Added setting to control how deep Gitblit will recurse into *git.repositoriesFolder* looking for repositories (issue 399)
- - Added setting to specify regex exclusions for repositories (issue 399)
- - Blob page now supports displaying images (issue 302)
- - Non-image binary files can now be downloaded using the RAW link
- - Support StartTLS in LdapUserService (issue 418)
- - Added Korean translation
-
- changes:
- - Line breaks inserted for readability in raw Markdown content display in the event of a parsing/transformation error. An error message is now displayed prepended to the raw content.
- - Improve UTF-8 reading for Markdown files
- - Updated Polish translation
- - Updated Japanese translation
- - Updated Spanish translation
-
- settings:
- - { name: git.cacheRepositoryList, defaultValue: 'true' }
- - { name: git.submoduleUrlPatterns, defaultValue: * }
- - { name: git.searchExclusions, defaultValue: * }
- - { name: git.searchRecursionDepth, defaultValue: -1 }
- - { name: git.defaultAuthorizationControl, defaultValue: NAMED }
-
- contributors:
- - James Moger
- - Steffen Gebert
-}
-
-#
-# 1.0.0
-#
-r13: {
- title: Gitblit 1.0.0 Released
- id: 1.0.0
- date: 2012-07-14
-
- fixes:
- - Fixed bug in Lucene search where old/stale blobs were never properly deleted during incremental updates. This resulted in duplicate blob entries in the index.
- - Fixed intermittent bug in identifying line numbers in Lucene search (issue 401)
- - Adjust repository identification algorithm to handle the scenario where a repository name collides with a group/folder name (e.g. foo.git and foo/bar.git) (issue 400)
- - Fixed bug where a repository set as *authenticated push* did not have anonymous clone access (issue 392)
- - Fixed bug in Basic authentication if passwords had a colon
- - Fixed bug where the Gitblit Manager could not update a setting that was not referenced in reference.properties (issue 381)
-
- changes:
- - ''**Updated Lucene index version which will force a rebuild of ALL your Lucene indexes**
- Make sure to properly set *web.blobEncodings* before starting Gitblit if you are updating! (issue 393)''
- - Changed default layout for web ui from Fixed-Width layout to Responsive layout (issue 397)
- - ''IUserService interface has changed to better accomodate custom authentication and/or custom authorization.
- The default `users.conf` now supports persisting display names and email addresses.''
- - Updated Japanese translation
-
- additions:
- - Added setting to allow specification of a robots.txt file (issue 395)
- - ''Added setting to control Responsive layout or Fixed-Width layout (issue 397)
- Responsive layout is now the default. This layout gracefully scales the web ui from a desktop layout to a mobile layout by hiding page components. It is easy to try, just resize your browser or point your Android/iOS device to the url of your Gitblit install.''
- - Added setting to control charsets for blob string decoding. Default encodings are UTF-8, ISO-8859-1, and the server default charset. (issue 393)
- - ''Exposed JGit internal configuration settings in gitblit.properties/web.xml (issue 389)
- Review your `gitblit.properties` or `web.xml` for detailed explanations of these settings.''
- - Added default access restriction. Applies to new repositories and repositories that have not been configured with Gitblit. (issue 384)
- - Added Ivy 2.2.0 dependency which enables Groovy Grapes, a mechanism to resolve and retrieve library dependencies from a Maven 2 repository within a Groovy push hook script
- - ''Added setting to control Groovy Grape root folder (location where resolved dependencies are stored)
- [Grape](http://groovy.codehaus.org/Grape) allows you to add Maven dependencies to your pre-/post-receive hook script classpath.''
- - Added LDAP User Service with many new *realm.ldap* keys
- - ''Added support for custom repository properties for Groovy hooks
- Custom repository properties complement hook scripts by providing text field prompts in the web ui and the Gitblit Manager for the defined properties. This allows your push hooks to be parameterized.''
- - Added script to facilitate proxy environment setup on Linux
- - Added Polish translation
- - Added Spanish translation
-
- settings:
- - { name: groovy.grapeFolder, defaultValue: groovy/grape }
- - { name: web.robots.txt, defaultValue: }
- - { name: web.useResponsiveLayout, defaultValue: 'true' }
- - { name: web.blobEncodings, defaultValue: UTF-8 ISO-8859-1 }
- - { name: git.defaultAccessRestriction, defaultValue: NONE }
- - { name: git.packedGitWindowSize, defaultValue: 8k }
- - { name: git.packedGitLimit, defaultValue: 10m }
- - { name: git.deltaBaseCacheLimit, defaultValue: 10m }
- - { name: git.packedGitOpenFiles, defaultValue: 128 }
- - { name: git.streamFileThreshold, defaultValue: 50m }
- - { name: git.packedGitMmap, defaultValue: 'false' }
-
- dependencyChanges:
- - Bootstrap 2.0.4
- - JGit 2.0.0.201206130900-r
- - Groovy 1.8.6
- - Gson 1.7.2
- - Log4J 1.2.17
- - SLF4J 1.6.6
- - Apache Commons Daemon 1.0.10
- - Ivy 2.2.0
-
- contributors:
- - James Moger
- - Eduardo Guervos Narvaez
- - Lukasz Jader
- - github/mragab
- - github/jcrygier
- - github/zakki
- - github/peterloron
-}
-
-#
-# 0.9.3
-#
-r12: {
- title: Gitblit 0.9.3 Released
- id: 0.9.3
- date: 2012-04-11
-
- fixes:
- - Fixed bug where you could not remove all selections from a RepositoryModel list (permitted users, permitted teams, hook scripts, federation sets, etc) (issue 377)
- - Automatically set *java.awt.headless=true* for Gitblit GO
-
- contributors:
- - James Moger
-}
-
-#
-# 0.9.2
-#
-r11: {
- title: Gitblit 0.9.2 Released
- id: 0.9.2
- date: 2012-04-04
-
- changes:
- - Added *clientLogger* bound variable to Groovy hook mechanism to allow custom info and error messages to be returned to the client
-
- fixes:
- - Fixed absolute path/canonical path discrepancy between Gitblit and JGit regarding use of symlinks (issue 374)
- - Fixed row layout on activity page (issue 375)
- - Fixed Centos service script
- - Fixed EditRepositoryPage for IE8; missing save button (issue 376)
-
- contributors:
- - James Moger
- - github/jonnybbb
- - github/mohamedmansour
- - github/jcrygier
-}
-
-#
-# 0.9.1
-#
-r10: {
- title: Gitblit 0.9.1 Released
- id: 0.9.1
- date: 2012-03-27
-
- fixes:
- - Lucene folder was stored in working copy instead of in .git folder
-
- contributors:
- - James Moger
-}
-
-#
-# 0.9.0
-#
-r9: {
- title: Gitblit 0.9.0 Released
- id: 0.9.0
- date: 2012-03-27
-
- security:
- - Fixed session fixation vulnerability where the session identifier was not reset during the login process (issue 358)
-
- changes:
- - Reject pushes to a repository with a working copy (i.e. non-bare repository) (issue-345)
- - Changed default web.datetimestampLongFormat from *EEEE, MMMM d, yyyy h:mm a z* to *EEEE, MMMM d, yyyy HH:mm Z* (issue 346)
- - Expanded commit age coloring from 2 days to 30 days (issue 353)
-
- additions:
- - ''Added optional Lucene branch indexing (issue 312)
- Repository branches may be optionally indexed by Lucene for improved searching. To use this feature you must specify which branches to index within the *Edit Repository* page; _no repositories are automatically indexed_. Gitblit will build or incrementally update enrolled repositories on a 2 minute cycle. (i.e you will have to wait 2-3 minutes after respecifying indexed branches or pushing new commits before Gitblit will build/update the repository Lucene index.)
- If a repository has Lucene-indexed branches the *search* form on the repository pages will redirect to the root-level Lucene search page and only the content of those branches can be searched.
- If the repository does not specify any indexed branches then repository commit-traversal search is used.
-
- **Note:** Initial indexing of an existing repository can be memory-exhaustive. Be sure to provide your Gitblit server adequate heap space to index your repositories (e.g. -Xmx1024M).
- See the [setup](setup.html) page for additional details.''
- - Allow specifying timezone to use for Gitblit which is independent of both the JVM and the system timezone (issue 350)
- - Added a built-in AJP connector for integrating Gitblit GO into an Apache mod_proxy setup (issue 355)
- - ''On the Repositories page show a bang *!* character in the color swatch of a repository with a working copy (issue 345)
- Push requests to these repositories will be rejected.''
- - On all non-bare Repository pages show *WORKING COPY* in the upper right corner (issue 345)
- - New setting to prevent display/serving non-bare repositories
- - Added *protect-refs.groovy*
- - Allow setting default branch (relinking HEAD) to a branch or a tag
- - Added Ubuntu service init script (issue 368)
- - Added partial Japanese translation
-
- fixes:
- - Ensure that Welcome message is parsed using UTF-8 encoding (issue 370)
- - Activity page chart layout broken by Google (issue 369)
- - Uppercase repositories not selectable in edit palettes (issue 367)
- - Not all git notes were properly displayed on the commit page (issue 366)
- - Activity page now displays all local branches (issue 361)
- - Fixed (harmless) nullpointer on pushing to an empty repository (issue 365)
- - Fixed possible nullpointer from the servlet container on startup (issue 363)
- - Fixed UTF-8 encoding bug on diff page (issue 362)
- - Fixed timezone bugs on the activity page (issue 350)
- - Prevent add/edit team with no selected repositories (issue 352)
- - Disallow browser autocomplete on add/edit user/team/repository pages
- - Fixed username case-sensitivity issues (issue 339)
- - Disregard searching a subfolder if Gitblit does not have filesystem permissions (issue 347)
-
- settings:
- - { name: web.allowLuceneIndexing, defaultValue: 'true' }
- - { name: web.luceneIgnoreExtensions, defaultValue: 7z arc arj bin bmp dll doc docx exe gif gz jar jpg lib lzh odg odf odt pdf ppt png so swf xcf xls xlsx zip }
- - { name: web.timezone, defaultValue: }
- - { name: server.ajpPort, defaultValue: 0 }
- - { name: server.ajpBindInterface, defaultValue: localhost }
- - { name: git.onlyAccessBareRepositories, defaultValue: 'false' }
-
- dependencyChanges:
- - Bootstrap 2.0.2
- - MarkdownPapers 1.2.7
- - JGit 1.3.0.201202151440-r
- - Wicket 1.4.20
-
- contributors:
- - James Moger
- - github/lemval
- - github/zakki
- - github/plm
-}
-
-#
-# 0.8.2
-#
-r8: {
- title: Gitblit 0.8.2 Released
- id: 0.8.2
- date: 2012-01-13
-
- fixes:
- - Fixed bug when upgrading from users.properties to users.conf (issue 337)
-
- contributors:
- - James Moger
-}
-
-#
-# 0.8.1
-#
-r7: {
- title: Gitblit 0.8.1 Released
- id: 0.8.1
- date: 2012-01-11
-
- fixes:
- - Include missing icon resource for the manager (issue 336)
- - Fixed sendmail.groovy message content with incorrect tag/branch labels
-
- contributors:
- - James Moger
-}
-
-#
-# 0.8.0
-#
-r6: {
- title: Gitblit 0.8.0 Released
- id: 0.8.0
- date: 2012-01-11
-
- additions:
- - ''Platform-independent, Groovy push hook script mechanism.
- Hook scripts can be set per-repository, per-team, or globally for all repositories.''
- - ''*sendmail.groovy* for optional email notifications on push.
- You must properly configure your SMTP server settings in `gitblit.properties` or `web.xml` to use *sendmail.groovy*.''
- - New global key for mailing lists. This is used in conjunction with the *sendmail.groovy* hook script. All repositories that use the *sendmail.groovy* script will include these addresses in the notification process. Please see the Setup page for more details about configuring sendmail.
- - *com.gitblit.GitblitUserService*. This is a wrapper object for the built-in user service implementations. For those wanting to only implement custom authentication it is recommended to subclass GitblitUserService and override the appropriate methods. Going forward, this will help insulate custom authentication from new IUserService API and/or changes in model classes.
- - ''New default user service implementation: *com.gitblit.ConfigUserService* (`users.conf`)
- This user service implementation allows for serialization and deserialization of more sophisticated Gitblit User objects without requiring the encoding trickery now present in FileUserService (users.properties). This will open the door for more advanced Gitblit features.
- For those upgrading from an earlier Gitblit version, a `users.conf` file will automatically be created for you from your existing `users.properties` file on your first launch of Gitblit however you will have to manually set *realm.userService=users.conf* to switch to the new user service.
- The original `users.properties` file and the corresponding implementation are **deprecated**.''
- - Teams for specifying user-repository access in bulk. Teams may also specify mailing lists addresses and pre- & post- receive hook scripts.
- - Gravatar integration
- - Activity page for aggregated repository activity. This is a timeline of commit activity over the last N days for one or more repositories.
- - *Filters* menu for the Repositories page and Activity page. You can filter by federation set, team, and simple custom regular expressions. Custom expressions can be stored in `gitblit.properties` or `web.xml` or directly defined in your url (issue 323)
- - Flash-based 1-step *copy to clipboard* of the primary repository url based on Clippy
- - JavaScript-based 3-step (click, ctrl+c, enter) *copy to clipboard* of the primary repository url in the event that you do not want to use Flash on your installation
- - Empty repositories now link to an *empty repository* page which gives some direction to the user for the next step in using Gitblit. This page displays the primary push/clone url of the repository and gives sample syntax for the git command-line client. (issue 327)
- - Repositories with a *gh-pages* branch will now have a *pages* link which will serve the content of this branch. All resource requests are against the repository, Gitblit does not checkout/export this branch to a temporary filesystem. Jekyll templating is not supported.
- - Gitblit Express bundle to get started running Gitblit on RedHat OpenShift cloud BETA
-
- changes:
- - Dropped display of trailing .git from repository names
- - ''Gitblit GO is now monolithic like the WAR build. (issue 326)
- This change helps adoption of GO in environments without an internet connection or with a restricted connection.''
- - Unit testing framework has been migrated to JUnit4 syntax and the test suite has been redesigned to run all unit tests, including rpc, federation, and git push/clone tests
-
- fixes:
- - Several a bugs in FileUserService related to cleaning up old repository permissions on a rename or delete
- - Renaming a repository into a new subfolder failed (issue 329)
-
- settings:
- - { name: groovy.scriptsFolder, defaultValue: groovy }
- - { name: groovy.preReceiveScripts, defaultValue: }
- - { name: groovy.postReceiveScripts, defaultValue: }
- - { name: mail.mailingLists, defaultValue: }
- - { name: realm.userService, defaultValue: users.conf }
- - { name: web.allowGravatar, defaultValue: 'true' }
- - { name: web.activityDuration, defaultValue: 14 }
- - { name: web.timeFormat, defaultValue: HH:mm }
- - { name: web.datestampLongFormat, defaultValue: "EEEE, MMMM d, yyyy" }
- - { name: web.customFilters, defaultValue: }
- - { name: web.allowFlashCopyToClipboard, defaultValue: 'true' }
-
- dependencyChanges:
- - JGit 1.2.0
- - Groovy 1.8.5
- - Clippy
-
- contributors:
- - James Moger
-}
-
-#
-# 0.7.0
-#
-r5: {
- title: Gitblit 0.7.0 Released
- id: 0.7.0
- date: 2011-11-11
-
- security:
- - fixed security hole when cloning clone-restricted repository with TortoiseGit (issue 324)
-
- fixes:
- - ''federation protocol timestamps. dates are now serialized to the [iso8601](http://en.wikipedia.org/wiki/ISO_8601) standard.
- **This breaks 0.6.0 federation clients/servers.**''
- - collision on rename for repositories and users
- - Gitblit can now browse the Linux kernel repository (issue 321)
- - Gitblit now runs on Servlet 3.0 webservers (e.g. Tomcat 7, Jetty 8) (issue 319)
- - Set the RSS content type of syndication feeds for Firefox 4 (issue 318)
- - RSS feeds are now properly encoded to UTF-8
- - RSS feeds now properly generate parameterized links if *web.mountParameters=false*
- - Null pointer exception if did not set federation strategy (issue 316)
- - Gitblit GO allows SSL renegotiation if running on Java 1.6.0_22 or later
-
- changes:
- - updated ui with Twitter Bootstrap CSS toolkit
- - repositories list performance by caching repository sizes (issue 323)
- - summary page performance by caching metric calculations (issue 321)
-
- additions:
- - authenticated JSON RPC mechanism
- - Gitblit API RSS/JSON RPC library
- - Gitblit Manager (Java/Swing Application) for remote administration of a Gitblit server.
- - per-repository setting to skip size calculation (faster repositories page loading)
- - per-repository setting to skip summary metrics calculation (faster summary page loading)
- - IUserService.setup(IStoredSettings) for custom user service implementations
- - setting to control Gitblit GO context path for proxy setups
- - *combined-md5* password storage option which stores the hash of username+password as the password
- - repository owners are automatically granted access for git, feeds, and zip downloads without explicitly selecting them
- - RSS feeds now include regex substitutions on commit messages for bug trackers, etc
-
- settings:
- - { name: web.loginMessage, defaultValue: gitblit }
- - { name: web.enableRpcServlet, defaultValue: 'true' }
- - { name: web.enableRpcManagement, defaultValue: 'false' }
- - { name: web.enableRpcAdministration, defaultValue: 'false' }
- - { name: server.contextPath, defaultValue: / }
-
- dependencyChanges:
- - MarkdownPapers 1.2.5
- - Wicket 1.4.19
-
- contributors:
- - James Moger
- - github/dadalar
- - github/alyandon
- - github/trygvis
-}
-
-#
-# 0.6.0
-#
-r4: {
- title: Gitblit 0.6.0 Released
- id: 0.6.0
- date: 2011-09-27
-
- fixes:
- - syndication urls for WAR deployments
- - authentication for zip downloads
-
- additions:
- - federation feature to allow gitblit instances (or gitblit federation clients) to pull repositories and, optionally, settings and accounts from other gitblit instances. This is something like [svn-sync](http://svnbook.red-bean.com/en/1.5/svn.ref.svnsync.html) for gitblit.
- - user role *#notfederated* to prevent a user account from being pulled by a federated Gitblit instance
-
- settings:
- - { name: federation.name, defaultValue: }
- - { name: federation.passphrase, defaultValue: }
- - { name: federation.allowProposals, defaultValue: 'false' }
- - { name: federation.proposalsFolder, defaultValue: proposals }
- - { name: federation.defaultFrequency, defaultValue: 60 mins }
- - { name: federation.sets, defaultValue: }
- - { name: "mail.*", defaultValue: }
-
- dependencyChanges:
- - MarkdownPapers 1.1.1
- - Wicket 1.4.18
- - JGit 1.1.0
- - google-gson
- - javamail
-
- contributors:
- - James Moger
-}
-
-#
-# 0.5.2
-#
-r3: {
- title: Gitblit 0.5.2 Released
- id: 0.5.2
- date: 2011-07-27
-
- fixes:
- - active repositories with a HEAD that pointed to an empty branch caused internal errors (issue 310)
- - bare-cloned repositories were listed as (empty) and were not clickable (issue 309)
- - default port for Gitblit GO is now 8443 to be more linux/os x friendly (issue 308)
- - repositories can now be reliably deleted and renamed (issue 306)
- - always show root repository group first, i.e. do not sort root group with other groups
- - tone-down repository group header color
-
- additions:
- - users can now change their passwords (issue 297)
- - optionally display repository on-disk size on repositories page
- - forward-slashes ('/', %2F) can be encoded using a custom character to workaround some servlet container default security measures for proxy servers
-
- settings:
- - { name: web.showRepositorySizes, defaultValue: 'true' }
- - { name: web.forwardSlashCharacter, defaultValue: / }
-
- dependencyChanges:
- - MarkdownPapers 1.1.0
- - Jetty 7.4.3
-
- contributors:
- - James Moger
-}
-
-#
-# 0.5.1
-#
-r2: {
- title: Gitblit 0.5.1 Released
- id: 0.5.1
- date: 2011-06-28
-
- changes:
- - clarified SSL certificate generation and configuration for both server-side and client-side
- - added some more troubleshooting information to documentation
- - replaced JavaService with Apache Commons Daemon
-
- contributors:
- - James Moger
-}
-
-#
-# 0.5.0
-#
-r1: {
- title: Gitblit 0.5.0 Released
- id: 0.5.0
- date: 2011-06-26
- text: initial release
-
- contributors:
- - James Moger
-}
-
-snapshot: &r35
-release: &r34
-releases: &r[1..34]
diff --git a/rpc.html b/rpc.html
new file mode 100644
index 000000000..f3bbdeda1
--- /dev/null
+++ b/rpc.html
@@ -0,0 +1,414 @@
+
+
+
+
+Gitblit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Gitblit optionally allows a remote client to administer the Gitblit server. This client could be a Java-based tool or perhaps a tool written in another language.
https is strongly recommended because passwords are insecurely transmitted from your browser/rpc client using Basic authentication!
The Gitblit JSON RPC mechanism, like the Gitblit JGit servlet, syndication/feed servlet, etc, supports request-based authentication. Making an admin request will trigger Gitblit's basic authentication mechanism. Listing of repositories, generally, will not trigger this authentication mechanism unless web.authenticateViewPages=true. That means its possible to allow anonymous enumeration of repositories that are not view restricted or clone restricted. Of course, if credentials are provided then all private repositories that are available to the user account will be enumerated in the JSON response.
+
Gitblit Manager
The Gitblit Manager is an example Java/Swing application that allows remote management (repository and user objects) and administration (server settings) of a Gitblit server.
This application uses a combination of RSS feeds and the JSON RPC interface, both of which are part of the Gitblit API library, to present live information from a Gitblit server. Some JSON RPC methods from the utility class com.gitblit.utils.RpcUtils are not currently used by the Gitblit Manager.
NOTE: Gitblit Manager stores your login credentials INSECURELY in homedir/.gitblit/config.
+
RSS Query Interface
At present, Gitblit does not yet support retrieving Git objects (commits, etc) via the JSON RPC mechanism. However, the repository/branch RSS feeds can be used to extract log/history information from a repository branch.
The Gitblit API includes methods for retrieving and interpreting RSS feeds. The Gitblit Manager uses these methods to allow branch activity monitoring and repository searching.
+
+
url parameter
default
description
+
standard query
+
repository
required
repository name is part of the url (see examples below)
+
ot=
optional default: COMMIT
object type to return in results. COMMIT or TAG
+
h=
optional default: HEAD
starting branch, ref, or commit id
+
l=
optional default: web.syndicationEntries
maximum return count
+
pg=
optional default: 0
page number for paging (offset into history = pagenumber*maximum return count)
+
+
+
+
+
\ No newline at end of file
diff --git a/src/site/resources/screenshots.js b/screenshots.js
similarity index 100%
rename from src/site/resources/screenshots.js
rename to screenshots.js
diff --git a/src/site/screenshots/00.png b/screenshots/00.png
similarity index 100%
rename from src/site/screenshots/00.png
rename to screenshots/00.png
diff --git a/src/site/screenshots/00b.png b/screenshots/00b.png
similarity index 100%
rename from src/site/screenshots/00b.png
rename to screenshots/00b.png
diff --git a/src/site/screenshots/00c.png b/screenshots/00c.png
similarity index 100%
rename from src/site/screenshots/00c.png
rename to screenshots/00c.png
diff --git a/src/site/screenshots/00d.png b/screenshots/00d.png
similarity index 100%
rename from src/site/screenshots/00d.png
rename to screenshots/00d.png
diff --git a/src/site/screenshots/01.png b/screenshots/01.png
similarity index 100%
rename from src/site/screenshots/01.png
rename to screenshots/01.png
diff --git a/src/site/screenshots/01b.png b/screenshots/01b.png
similarity index 100%
rename from src/site/screenshots/01b.png
rename to screenshots/01b.png
diff --git a/src/site/screenshots/01c.png b/screenshots/01c.png
similarity index 100%
rename from src/site/screenshots/01c.png
rename to screenshots/01c.png
diff --git a/src/site/screenshots/02.png b/screenshots/02.png
similarity index 100%
rename from src/site/screenshots/02.png
rename to screenshots/02.png
diff --git a/src/site/screenshots/03.png b/screenshots/03.png
similarity index 100%
rename from src/site/screenshots/03.png
rename to screenshots/03.png
diff --git a/src/site/screenshots/04.png b/screenshots/04.png
similarity index 100%
rename from src/site/screenshots/04.png
rename to screenshots/04.png
diff --git a/src/site/screenshots/05.png b/screenshots/05.png
similarity index 100%
rename from src/site/screenshots/05.png
rename to screenshots/05.png
diff --git a/src/site/screenshots/06.png b/screenshots/06.png
similarity index 100%
rename from src/site/screenshots/06.png
rename to screenshots/06.png
diff --git a/src/site/screenshots/07.png b/screenshots/07.png
similarity index 100%
rename from src/site/screenshots/07.png
rename to screenshots/07.png
diff --git a/src/site/screenshots/08.png b/screenshots/08.png
similarity index 100%
rename from src/site/screenshots/08.png
rename to screenshots/08.png
diff --git a/src/site/screenshots/09.png b/screenshots/09.png
similarity index 100%
rename from src/site/screenshots/09.png
rename to screenshots/09.png
diff --git a/src/site/screenshots/10.png b/screenshots/10.png
similarity index 100%
rename from src/site/screenshots/10.png
rename to screenshots/10.png
diff --git a/src/site/screenshots/11.png b/screenshots/11.png
similarity index 100%
rename from src/site/screenshots/11.png
rename to screenshots/11.png
diff --git a/src/site/screenshots/12.png b/screenshots/12.png
similarity index 100%
rename from src/site/screenshots/12.png
rename to screenshots/12.png
diff --git a/src/site/screenshots/13.png b/screenshots/13.png
similarity index 100%
rename from src/site/screenshots/13.png
rename to screenshots/13.png
diff --git a/src/site/screenshots/14.png b/screenshots/14.png
similarity index 100%
rename from src/site/screenshots/14.png
rename to screenshots/14.png
diff --git a/src/site/screenshots/15.png b/screenshots/15.png
similarity index 100%
rename from src/site/screenshots/15.png
rename to screenshots/15.png
diff --git a/src/site/screenshots/m00.png b/screenshots/m00.png
similarity index 100%
rename from src/site/screenshots/m00.png
rename to screenshots/m00.png
diff --git a/src/site/screenshots/m01.png b/screenshots/m01.png
similarity index 100%
rename from src/site/screenshots/m01.png
rename to screenshots/m01.png
diff --git a/src/site/screenshots/m02.png b/screenshots/m02.png
similarity index 100%
rename from src/site/screenshots/m02.png
rename to screenshots/m02.png
diff --git a/src/site/screenshots/m03.png b/screenshots/m03.png
similarity index 100%
rename from src/site/screenshots/m03.png
rename to screenshots/m03.png
diff --git a/src/site/screenshots/m04.png b/screenshots/m04.png
similarity index 100%
rename from src/site/screenshots/m04.png
rename to screenshots/m04.png
diff --git a/src/site/screenshots/m05.png b/screenshots/m05.png
similarity index 100%
rename from src/site/screenshots/m05.png
rename to screenshots/m05.png
diff --git a/src/site/screenshots/m06.png b/screenshots/m06.png
similarity index 100%
rename from src/site/screenshots/m06.png
rename to screenshots/m06.png
diff --git a/src/site/screenshots/m07.png b/screenshots/m07.png
similarity index 100%
rename from src/site/screenshots/m07.png
rename to screenshots/m07.png
diff --git a/src/site/screenshots/m08.png b/screenshots/m08.png
similarity index 100%
rename from src/site/screenshots/m08.png
rename to screenshots/m08.png
diff --git a/src/site/screenshots/m09.png b/screenshots/m09.png
similarity index 100%
rename from src/site/screenshots/m09.png
rename to screenshots/m09.png
diff --git a/src/site/screenshots/m10.png b/screenshots/m10.png
similarity index 100%
rename from src/site/screenshots/m10.png
rename to screenshots/m10.png
diff --git a/setup_authentication.html b/setup_authentication.html
new file mode 100644
index 000000000..e23437ac5
--- /dev/null
+++ b/setup_authentication.html
@@ -0,0 +1,269 @@
+
+
+
+
+Gitblit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
By default, Gitblit stores and authenticates all users against users.conf. However, you may wish to integrate Gitblit into an existing user account infrastructure.
Gitblit supports additional authentication mechanisms aside from it's internal one.
+
+
LDAP authentication
+
Windows authentication
+
PAM authentication
+
Htpasswd authentication
+
HTTP header authentication
+
Redmine auhentication
+
Salesforce.com authentication
+
Servlet container authentication
+
+
LDAP Authentication
SINCE 1.0.0
LDAP can be used to authenticate Users and optionally control Team memberships. When properly configured, Gitblit will delegate authentication to your LDAP server and will cache some user information in the usual users.conf file.
When using the LDAP User Service, new user accounts can not be manually created from Gitblit. Gitblit user accounts are automatically created for new users on their first succesful authentication through Gitblit against the LDAP server. It is also important to note that the LDAP User Service does not retrieve or store user passwords nor does it implement any LDAP-write functionality.
To use the LdapUserService set realm.authenticationProviders=ldap in your gitblit.properties file and then configure the realm.ldap settings appropriately for your LDAP environment.
The following are the settings required to configure Gitblit to authenticate against the example LDAP server with LDAP-controlled team memberships.
+
+
+
parameter
value
description
+
+
+
+
realm.ldap.server
ldap://localhost:389
+
Tells Gitblit to connect to the LDAP server on localhost port 389. The URL Must be of form ldap(s)://<server>:<port> with port being optional (389 for ldap, 636 for ldaps).
+
+
+
realm.ldap.username
cn=Directory Manager
+
The credentials that will log into the LDAP server
+
+
+
realm.ldap.password
password
+
The credentials that will log into the LDAP server
+
+
+
realm.ldap.maintainTeams
true
+
Are team memberships maintained in LDAP (true) or manually in Gitblit (false).
The LDAP search filter that will match a particular user in LDAP. ${username} will be replaced with whatever the user enters as their username in the Gitblit login panel.
What is the root node for all teams in this LDAP system. Subtree searches will start from this node.
+
+
+
realm.ldap.groupMemberPattern
(&(objectClass=group)(member=${dn}))
The LDAP search filter that will match all teams for the authenticating user. ${username} will be replaced with whatever the user enters as their username in the Gitblit login panel. Anything else in ${} will be replaced by Attributes from the User node.
+
+
+
realm.ldap.admins
@Git_Admins
A space-delimited list of usernames and/or teams that indicate admin status in Gitblit. Teams are referenced with a leading @ character.
+
+
+
+
LDAP In-Memory Server
You can start Gitblit GO with an in-memory LDAP server by specifying the --ldapLdifFile command-line argument. The LDAP server will listen on localhost of the port specified in realm.ldap.url of gitblit.properties. Additionally, a root user record is automatically created for realm.ldap.username and realm.ldap.password. Please note that the ldaps:// protocol is not supported for the in-memory server.
+
Windows Authentication
Windows authentication is based on the use of Waffle and JNA. It is known to work properly for authenticating against the local Windows machine, but it is unclear if it works properly with a domain controller and Active Directory. To use this service, your Gitblit server must be installed on a Windows machine.
+
realm.authenticationProviders = windows
+realm.windows.defaultDomain =
+
+
PAM Authentication
PAM authentication is based on the use of libpam4j and JNA. To use this service, your Gitblit server must be installed on a Linux/Unix/MacOSX machine.
Then define a gitblit authentication policy in /etc/pam.d/gitblit
+
# PAM configuration for the gitblit service
+# Standard Un*x authentication.
+@include common-auth
+
+
Htpasswd Authentication
Htpasswd authentication allows you to maintain your user credentials in an Apache htpasswd file thay may be shared with other htpasswd-capable servers.
HTTP header authentication allows you to use existing authentication performed by a trusted frontend, such as a reverse proxy. Ensure that when used, gitblit is ONLY availabe via the trusted frontend, otherwise it is vulnerable to a user adding the header explicitly.
By default, no user or team header is defined, which results in all authentication failing this mechanism. The user header can also be defined while leaving the team header undefined, which causes users to be authenticated from the headers, but team memberships to be maintained locally.
You may authenticate your users against a Redmine installation as long as your Redmine install has properly enabled API authentication. This user service only supports user authentication; it does not support team creation based on Redmine groups. Redmine administrators will also be Gitblit administrators.
You may authenticate your users against Salesforce.com. You can require that user's belong to a particular organization by specifying a non-zero organization id.
If you are using the WAR variant and deploying into your own servlet container which has a pre-defined authentication mechanism protecting the Gitblit webapp, then you may instruct Gitblit to automatically create Gitblit accounts for container-authenticated user principals.
+
realm.container.autoCreateAccounts = true
+
+
Custom Authentication
This is the simplest choice where you implement custom authentication and delegate all other standard user and team operations to one of Gitblit's user service implementations. This choice insulates your customization from changes in User and Team model classes and additional API that may be added to IUserService.
You may use your subclass by specifying its fully qualified classname in the realm.authenticationProviders setting.
Your subclass must be on Gitblit's classpath and must have a public default constructor.
+
Custom Everything
Instead of maintaining a users.conf file, you may want to integrate Gitblit into an existing environment.
You may use your own custom com.gitblit.IUserService implementation by specifying its fully qualified classname in the realm.userService setting.
Your user service class must be on Gitblit's classpath and must have a public default constructor. Please see the following interface definition com.gitblit.IUserService.
+
+
Bugtraq is a specification started by Syntevo & supported by Gitblit to establish a standard to define and parse commit messages for linkable text.
+
Why do I care?
It's a portable way for your repository to have linkable issue, pull request, change-id, etc text fragments. SmartGit/Hg and Gitblit both use the reference implementation available in the aforementioned Github project so if you configure Bugtraq for one you automatically get linked text in the other.
+
How do I define the configuration?
You add a .gitbugtraq file to the root of your repository on the default branch.
This file is formatted like a standard Git config file. Here are some quick examples:
Gitblit supports defining menus for native platform git client clone urls. By default, Gitblit ships with client definitions for Git, SmartGit/Hg, SourceTree, Tower, and Github for Mac & Windows. Gitblit uses the browser's user-agent to help filter the list of available clients in addition to served transports and user access permissions.
You can define new client integrations and deactivate/remove the default integrations by creating a file $(baseFolder}/clientapps.json.
First, create a new filter file gitblit.conf in filter directory (Debian/CentOS: /etc/fail2ban/filter.d/) or into filter.conf file. Here is an example:
+
[Definition]
+failregex = Failed login attempt for .+, invalid credentials from <HOST>\s*$
+ could not authenticate .*? \(/<HOST>:[0-9]*\) for SSH using the supplied password$
+ignoreregex =
+
Then edit jail.conf to add "gitblit" service (Debian: /etc/fail2ban/jail.conf). For example:
Gitblit is configured to work straight away. However you may want to update the following in gitblit.properties:
+
+
+
parameter
value
description
+
+
+
+
filestore.storageFolder
${baseFolder}/lfs
+
The path on the server where filestore objects are to be saved.
+
+
+
filestore.maxUploadSize
-1
+
The maximum allowable size that can be uploaded to the filestore. Once a file is uploaded it will be unaffected by later changes in this property. The default of -1 indicates no limits.
+
+
+
+
Limitations
Gitblit currently provides a server-only implementation of the opensource Git LFS API.
+
+
Files in the filestore are not currently searchable by Lucene.
+
Mirroring a repository that uses Git LFS will only mirror the pointer files, not the large files.
+
Federation - Only the pointer files, not the large files, are transfered.
Files that should be handled by Git LFS are defined in the .gitattributes file.
+
Git LFS installs a pre-commit hook when installed git lfs install.
+
When a commit is made the pre-commit hook replaces the defined Git LFS files with a pointer file containing metadata about the file so that it can be found later.
+
When a commit is pushed, the changeset is sent to the git repository and the large files are sent to the filestore.
It is possible to migrate an existing repository containing large files to one that leverages the filestore. However, commit hash history will be altered.
The following command may be run on a local repository:
The server itself is configured through a simple text file. Open data/gitblit.properties in your favorite text editor and make sure to review and set:
+
+
server.httpPort and server.httpsPort
+
server.storePassword (do not enter # characters) https is strongly recommended because passwords are insecurely transmitted form your browser/git client using Basic authentication!
+
git.packedGitLimit (set larger than the size of your largest repository)
+
+
Windows: Execute authority.cmd or java -cp "gitblit.jar;%CD%\ext\*" com.gitblit.authority.GitblitAuthority --baseFolder data from a command-line. Linux/OSX: Execute authority.sh or java -cp "gitblit.jar:ext/*" com.gitblit.authority.GitblitAuthority --baseFolder data from a command-line. NOTE: The Authority is a Swing GUI application. Use of this tool is not required as Gitblit GO will startup and create SSL certificates itself, BUT use of this tool allows you to control the identification metadata used in the generated self-signed certificates. Skipping this step will result in certificates with default metadata.
+
+
fill out the fields in the new certificate defaults dialog
+
enter the store password used in server.storePassword when prompted. This generates an SSL certificate for localhost.
+
you may want to generate an SSL certificate for the hostname or ip address hostnames you are serving from NOTE: You can only have one SSL certificate specified for a port.
+
exit the authority app
+
+
Windows: Execute gitblit.cmd or java -cp gitblit.jar;"%CD%\ext\*" com.gitblit.GitBlitServer --baseFolder data from a command-line Linux/OSX: Execute gitblit.sh or java -cp "gitblit.jar:ext/*"" com.gitblit.GitBlitServer --baseFolder data from a command-line
Enter the default administrator credentials: admin / admin and click the Login button NOTE: Make sure to change the administrator username and/or password!!
+
+
GO Data Location
By default, Gitblit GO stores all data (users, settings, repositories, etc) in the data subfolder of your GO installation. You may specify an external location for your data on the command-line by setting the --baseFolder argument. If you relocate the data folder then you must supply the --baseFolder argument to both GO and the Certificate Authority.
If you are deploying Gitblit to a *nix platform, you might consider moving the data folder out of the GO installation folder and then creating a symlink named "data" that points to your moved folder.
+
Specifying baseFolder via GITBLIT_HOME
You can specify GITBLIT_HOME either as an environment variable or as a -DGITBLIT_HOME JVM system property.
+
Including Other Properties
SINCE 1.7.0
Gitblit supports loading it's settings from multiple properties files. You can achieve this using the include=filename key. This setting supports loading multiple files using a comma as the delimiter. They are processed in the order defined and they may be nested (i.e. your included properties may include properties, etc, etc).
+
Creating your own Self-Signed SSL Certificate
Gitblit GO (and Gitblit Certificate Authority) automatically generates a Certificate Authority (CA) certificate and an ssl certificate signed by this CA certificate that is bound to localhost.
Remote Eclipse/EGit/JGit clients (< 3.0) will fail to communicate using this certificate because JGit always verifies the hostname of the certificate, regardless of the http.sslVerify=false client-side setting.
The EGit failure message is something like:
+
Cannot get remote repository refs.
+Reason: https:/myserver.com/git/myrepo.git: cannot open git-upload-pack
+
If you want to serve your repositories to another machine over https then you will want to generate a new certificate for the hostname or ip address you are serving from.
NOTE: The Gitblit Authority is a GUI tool and will require X11 forwarding on headless UNIX boxes.
+
+
Windows: authority.cmd or java -cp "gitblit.jar;%CD%\ext\*" com.gitblit.authority.GitblitAuthority --baseFolder data Linux/OSX: authority.sh or java -cp "gitblit.jar:ext/*" com.gitblit.authority.GitblitAuthority --baseFolder data
+
Click the new ssl certificate button (red rosette in the toolbar in upper left of window)
+
Enter the hostname or ip address
+
Make sure the checkbox serve https with this certificate is checked
+
In the keystore password prompt, enter the server.storePassword password
+
If you decide to change the value of server.storePassword (recommended) after you have already started Gitblit or Gitblit Certificate Authority, then you will have to delete the following files and then restart the Gitblit Certificate Authority app:
+
+
data/serverKeyStore.jks
+
data/serverTrustStore.jks
+
data/certs/caKeyStore.jks
+
data/certs/ca.crt
+
data/certs/caRevocationList.crl (optional)
+
+
Client SSL Certificates
SINCE 1.2.0
Gitblit supports X509 certificate authentication. This authentication method relies on your servlet container to validate/verify/trust your client certificate and can be used by your browser and your git client.
All X509 certificates have a distinguished name (DN) which is a signature of several fields like:
+
C=US,O=Gitblit,OU=Gitblit,CN=james
+
Gitblit must be able to map the DN of the certificate to an existing account username. The default mapping is to extract the common name (CN) value from the DN and use that as the account name. If the CN is a valid account, then the user is authenticated. The servlet container which runs Gitblit validates, verifies, and trusts the certificate passed to Gitblit. If you need to specify an alternative DN mapping you may do so with the git.certificateUsernameOIDs setting, but this mapping must be matched to the user account name.
How do you make your servlet container trust a client certificate?
In the WAR variant, you will have to manually setup your servlet container to:
+
+
want/need client certificates
+
trust a CA certificate used to sign your client certificates
+
generate client certificates signed by your CA certificate
+
Alternatively, Gitblit GO is designed to facilitate use of client certificate authentication. Gitblit GO ships with a tool that simplifies creation and management of client certificates, Gitblit Certificate Authority.
+
Creating SSL Certificates with Gitblit Certificate Authority
When you generate a new client certificate, a zip file bundle is created which includes a P12 keystore for browsers and a PEM keystore for Git. Both of these are password-protected. Additionally, a personalized README file is generated with setup instructions for popular browsers and Git. The README is generated from data\certs\instructions.tmpl and can be modified to suit your needs.
+
+
Windows: authority.cmd or java -cp "gitblit.jar;%CD%\ext\*" com.gitblit.authority.GitblitAuthority --baseFolder data Linux/OSX: authority.sh or java -cp "gitblit.jar:ext/*" com.gitblit.authority.GitblitAuthority --baseFolder data
+
Select the user for which to generate the certificate
+
Click the new certificate button and enter the expiration date of the certificate. You must also enter a password for the generated keystore. This password is not the same as the user's login password. This password is used to protect the privatekey and public certificate you will generate for the selected user. You must also enter a password hint for the user.
+
If your mail server settings are properly configured you will have a send email checkbox which you can use to immediately send the generated certificate bundle to the user.
+
+
Certificate Inspection and Advanced Troubleshooting
X509 certificates can be confusing and tricky even with the simplified Gitblit Certificate Authority tool. If you find you need more tooling to understand your keystores, certificates, and certificate revocation lists (CRLs), I highly recommend Portecle which can be conveniently launched as a Java Web Start app.
Review the contents of the installService.cmd where you may have to change the default keystore password.
+
Set the ARCH value as appropriate for your installed Java Virtual Machine.
+
Add any necessary --StartParams as enumerated below in Command-Line Parameters.
+
Execute the script.
+
After service installation you can use the gitblitw.exe utility to control and modify the runtime settings of the service. Additional service definition options and runtime capabilities of gitblitw.exe (prunmgr.exe) are documented here.
NOTE: If you change the name of the service from gitblit you must also change the name of gitblitw.exe to match the new service name otherwise the connection between the service and the utility is lost, at least to double-click execution.
+
VM Considerations
By default, the service installation script configures your Windows service to use your default JVM. This setup usually defaults to a client VM. If you have installed a JDK, you might consider using the gitblitw.exe utility to manually specify the server VM.
+
+
Execute gitblitw.exe
+
On the Java tab uncheck Use default.
+
Manually navigate your filesystem and specify the server VM with the ... button
Command-Line parameters override the values in gitblit.properties at runtime.
+
--baseFolder The default base folder for all relative file reference settings
+--repositoriesFolder Git Repositories Folder
+--userService Authentication and Authorization Service (filename or fully qualified classname)
+--httpPort HTTP port for to serve. (port <= 0 will disable this connector)
+--httpsPort HTTPS port to serve. (port <= 0 will disable this connector)
+--sshPort SSH Daemon port to serve. (port <= 0 will disable this daemon)
+--gitPort Git Daemon port to serve. (port <= 0 will disable this daemon)
+--alias Alias in keystore of SSL cert to use for https serving
+--storePassword Password for SSL (https) keystore.
+--shutdownPort Port for Shutdown Monitor to listen on. (port <= 0 will disable this monitor)
+--dailyLogFile Redirect logging to a rolling, daily log file instead of stdout
+--tempFolder Folder for server to extract built-in webapp
+
You can not use override the default log4j configuration AND specify the --dailyLogFile parameter. For reference, here is Gitblit's default Log4j configuration. It includes some file appenders that are disabled by default.
+
+
Gitblit uses Groovy for its push hook mechanism. This mechanism only executes when pushing to Gitblit, not when pushing to some other Git tooling in your stack.
The Groovy hook mechanism allows for dynamic extension of Gitblit to execute custom tasks on receiving and processing push events. The scripts run within the context of your Gitblit instance and therefore have access to Gitblit's internals at runtime.
+
Rules, Requirements, & Behaviors
+
+
Your Groovy scripts must be stored in the groovy.scriptsFolder as specified in gitblit.properties or web.xml.
+
All script files must have the .groovy extension. Because of this you may omit the extension when specifying the script.
+
Script filenames must not have spaces!
+
Scripts must be explicitly specified to be executed, no scripts are automatically executed by name or extension.
+
A script can be specified to run on all repositories by adding the script file name to groovy.preReceiveScripts or groovy.postReceiveScripts in gitblit.properties or web.xml.
+
Scripts can be specified for a team.
+
Scripts may also be specified per-repository in the repository's settings.
+
Globally-specified scripts and team-specified scripts are excluded from the list of available scripts in a repository's settings
+
Globally-specified scripts are executed first, in their listed order; followed by team-specified scripts in their listed order by alphabetical team order; followed by per-repository scripts, in their listed order.
+
A script may only be defined once in a pre-receive chain and once in a post-receive chain. You may execute the same script on pre-receive and post-receive, just not multiple times within a pre-receive or post-receive event.
+
Gitblit does not differentiate between what can be a pre-receive script and what can be a post-receive script.
+
If a script returns false then the hook chain is aborted and none of the subsequent scripts will execute.
+
Some sample scripts are included in the GO and WAR distributions to show you how you can tap into Gitblit with the provided bound variables. Additional implementation details may be specified in the header comment of these examples.
Hook contributions and improvements are welcome.
+
Grapes
SINCE 1.0.0
Grape lets you quickly add maven repository dependencies to your Groovy hook script.
+
Grape (The Groovy Adaptable Packaging Engine or Groovy Advanced Packaging Engine) is the infrastructure enabling the grab() calls in Groovy, a set of classes leveraging Ivy to allow for a repository driven module system for Groovy. This allows a developer to write a script with an essentially arbitrary library requirement, and ship just the script. Grape will, at runtime, download as needed and link the named libraries and all dependencies forming a transitive closure when the script is run from existing repositories such as Ibiblio, Codehaus, and java.net.
// create and use a primitive array
+import org.apache.commons.collections.primitives.ArrayIntList
+
+@Grab(group='commons-primitives', module='commons-primitives', version='1.0')
+def createEmptyInts() { new ArrayIntList() }
+
+def ints = createEmptyInts()
+ints.add(0, 42)
+assert ints.size() == 1
+assert ints.get(0) == 42
+
+
Custom Fields
SINCE 1.0.0
Gitblit allows custom repository string fields to be defined in gitblit.properties or web.xml. Entry textfields are automatically created for these fields in the Edit Repository page of Gitblit and the Edit Repository dialog of the Gitblit Manager. These fields are accessible from your Groovy hook scripts as
+
repository.customFields.myField
+
This feature allows you to customize the behavior of your hook scripts without hard-coding values in the hook scripts themselves.
+
Pre-Receive
Pre-Receive scripts execute after the pushed objects have all been written to the Git repository but before the refs have been updated to point to these new objects.
This is the appropriate point to block a push and is how many Git tools implement branch-write permissions.
+
Post-Receive
Post-Receive scripts execute after all refs have been updated.
This is the appropriate point to trigger continuous integration builds or send email notifications, etc.
+
Push Email Notifications
Gitblit implements email notifications in sendmail.groovy which uses the Groovy Hook Script mechanism. This allows for dynamic customization of the notification process at the installation site and serves as an example push script.
+
Enabling Push Notifications
In order to send email notifications on a push to Gitblit, this script must be specified somewhere in the post-receive script chain. You may specify sendmail in one of three places:
+
+
groovy.postReceiveScripts in gitblit.properties or web.xml, globally applied to all repositories
+
post-receive scripts of a Team definition
+
post-receive scripts of a Repository definition
+
+
Destination Addresses
Gitblit does not currently support individual subscriptions to repositories; i.e. a user can not subscribe or unsubscribe from push notifications.
However, Repository Managers and Administrators can specify subscribed email addresses in one of three places:
+
+
mail.mailingLists in gitblit.properties or web.xml, globally applied to all push-notified repositories
+
mailing lists in a Team definition, applied to all repositories that are part of the team definition
+
mailing lists in a Repository definition
+
All three sources are checked and merged into a unique list of destination addresses for push notifications.
NOTE: Care should be taken when devising your notification scheme as it relates to any VIEW restricted repositories you might have. Setting a global mailing list and activating push notifications for a VIEW restricted repository may send unwanted emails.
+
+
Repositories may optionally be indexed using the Lucene search engine. The Lucene search offers several advantages over commit-traversal search:
+
+
very fast commit and blob searches
+
multi-term searches
+
term-highlighted and syntax-highlighted fragment matches
+
multi-repository searches
+
+
How do I use it?
First you must ensure that web.allowLuceneIndexing is set true in gitblit.properties or web.xml. Then you must understand that Lucene indexing is an opt-in feature which means that no repositories are automatically indexed. Like anything else, this design has pros and cons.
+
Pros
+
+
no wasted cycles indexing repositories you will never search
+
you specify exactly what branches are indexed; experimental/dead/personal branches can be ignored
+
+
Cons
+
+
you specify exactly what branches are indexed
+
+
I have 300 repositories and you want me to specify indexed branches on each one??
Yeah, I agree that is inconvenient.
If you are using Gitblit GO there is a utility script add-indexed-branch.cmd which allows you to specify an indexed branch for many repositories in one step.
If you are using Gitblit WAR then, at present, you are out of luck unless you write your own script to traverse your repositories and use native Git to manipulate each repository config.
You may specify which branches should be indexed per-repository in the Edit Repository page. New/empty repositories may only specify the default branch which will resolve to whatever commit HEAD points to or the most recently updated branch if HEAD is unresolvable.
Indexes are built and incrementally updated on a 2 minute cycle so you may have to wait a few minutes before your index is built or before your latest pushes get indexed.
NOTE: After specifying branches, only the content from those branches can be searched via Gitblit. Gitblit will automatically redirect any queries entered on a repository's search box to the Lucene search page. Repositories that do not specify any indexed branches will use the traditional commit-traversal search.
+
Adequate Heap
The initial indexing of an existing repository can potentially exhaust the memory allocated to your Java instance and may throw OutOfMemory exceptions. Be sure to provide your Gitblit server adequate heap space to index your repositories. The heap is set using the -Xmx JVM parameter in your Gitblit launch command (e.g. -Xmx1024M).
+
Why does Gitblit check every 2 mins for repository/branch changes?
Gitblit has to balance its design as a complete, integrated Git server and its utility as a repository viewer in an existing Git setup.
Gitblit could build indexes immediately on edit repository or on receiving pushes, but that design would not work if someone is pushing via ssh://, git://, or file:// (i.e. not pushing to Gitblit http(s)://). For this reason Gitblit has a polling mechanism to check for ref changes every 2 mins. This design works well for all use cases, aside from adding a little lag in updating the index.
+
+
Gitblit supports mirroring external public repositories. The service that updates mirrors will be enabled after a restart with the following setting:
+
git.enableMirroring = true
+
Gitblit does not yet provide a web interface to setup a repository mirror so you will need to use native git for initial setup of your repository mirror.
+
+
Open a command prompt in your git.repositoriesFolder
+
Optionally create a subfolder for the mirror repositories and cd into that directory, for example you might put all mirrors together in a mirrors folder.
+
Clone the external public repository as a mirror
git clone --mirror <repository_url>
+
If Gitblit is currently running, login as the administrator and clear the repository cache
+
That's it. Gitblit will identify the newly cloned repository as a mirror, will enforce the necessary rules regarding mirrors, and will automatically fetch ref updates based on your configured git.mirrorPeriod setting.
+
git.mirrorPeriod = 30 mins
+
+
Rules, Requirements, & Gotchas
+
+
The origin remote must be the mirror source
+
The origin repository must be publicly accessible, or at least accessible without explicit authentication unless you embed the credentials in the origin url (not recommended).
+
origin SSH urls are untested and are very unlikely to work since Gitblit and JGit are not configured to look for your personal SSH keys. Stick to the http, https, or git transports.
+
Gitblit will automatically repair and ref specs that it finds with a // sequence.
+
Mirrors are read-only. You may not directly push to a mirror.
+
Mirrors can not have work trees. They must be a bare repository cloned using the --mirror flag.
Each Linux distribution may vary on the exact configuration of Apache 2.2. Here is a sample configuration that works on Debian 7.0 (Wheezy), your distribution may be different.
Now we must configure Apache to use the proxy modules and the proxied connection from Apache to Gitblit GO or from Apache to your chosen servlet container. The following snippet is stored as /etc/apache2/conf.d/gitblit.
# Turn off support for true Proxy behaviour as we are acting as
+# a transparent proxy
+ProxyRequests Off
+
+# Turn off VIA header as we know where the requests are proxied
+ProxyVia Off
+
+# Turn on Host header preservation so that the servlet container
+# can write links with the correct host and rewriting can be avoided.
+#
+# This is important for all git push/pull/clone operations.
+ProxyPreserveHost On
+
+# Set the permissions for the proxy
+<Proxy>
+ AddDefaultCharset off
+ Order deny,allow
+ Allow from all
+</Proxy>
+
+# The proxy context path must match the Gitblit context path.
+# For Gitblit GO, see server.contextPath in gitblit.properties.
+
+#ProxyPass /gitblit http://localhost:8080/gitblit
+#ProxyPassreverse /gitblit http://localhost:8080/gitblit
+
+# If your httpd frontend is https but you are proxying http Gitblit WAR or GO
+#Header edit Location ^http://([^/]+)/gitblit/ https://$1/gitblit/
+#Header edit Ajax-Location ^http://([^/]+)/gitblit/ https://$1/gitblit/
+
+# Additionally you will want to tell Gitblit the original scheme and port
+#RequestHeader set X-Forwarded-Proto https
+#RequestHeader set X-Forwarded-Port 443
+
+# If you are using subdomain proxying then you will want to tell Gitblit the appropriate
+# context path for your repository url.
+# If you are not using subdomain proxying, then ignore this setting.
+#RequestHeader set X-Forwarded-Context /
+
Please make sure to: 1. Review the security of these settings as appropriate for your deployment 2. Uncomment the ProxyPass setting 3. Correctly set the ports and context paths both in the ProxyPass definition and your Gitblit installation 4. Set web.mountParameters=false in gitblit.properties or web.xml this will use parameterized URLs. Alternatively, you can respecify web.forwardSlashCharacter.
+
Controlling Advertised Repository URLs
In some reverse-proxy configurations you may be running Gitblit using an http interface with an https reverse-proxy proxy. This will lead to Gitblit generating incorrect repository urls.
You can control the url that Gitblit generates by setting X-Forwarded headers in your proxy server.
You must tell Git/JGit not to verify the self-signed certificate in order to perform any remote Git operations.
NOTE: The default self-signed certificate generated by Gitblit GO is bound to localhost. If you are using Eclipse/EGit/JGit clients, you will have to generate your own certificate that specifies the exact hostname used in your clone/push url. You must do this because Eclipse/EGit/JGit (< 3.0) always verifies certificate hostnames, regardless of the http.sslVerify=false client-side setting.
NOTE: When generating self-signed certificates, the default Java TLS settings will be used. These default settings will generate a weak Diffie-Hellman key.
Java 8
The default is a 1024 bit DH key. You can up the number of bits used by appending the following command line parameter when starting Gitblit:
-Djdk.tls.ephemeralDHKeySize=2048
2048 bits is the maximum (Java limitation), and is still considered secure as of this writing.
Java 7
The default is a 768 bit key. This is hardcoded in Java 7 and cannot be changed.. It is very weak. If you require longer DH keys, use Java 8.
+
Http Post Buffer Size
You may find the default post buffer of your git client is too small to push large deltas to Gitblit. Sometimes this can be observed on your client as hanging during a push. Other times it can be observed by git erroring out with a message like: error: RPC failed; result=52, HTTP code = 0.
This can be adjusted on your client by changing the default post buffer size:
git config --global http.postBuffer 524288000
+
Disabling SNI
You may run into SNI alerts (Server Name Indication). These will manifest as failures to clone or push to your Gitblit instance.
+
Java-based Clients
Luckily, Java 6-based clients ignore SNI alerts but when using Java 7-based clients, SNI checking is enabled by default. You can disable SNI alerts by specifying the JVM system parameter -Djsse.enableSNIExtension=false when your Java-based client launches.
For Eclipse, you can append -Djsse.enableSNIExtension=false to your eclipse.ini file.
+
Native Clients
Native clients may display an error when attempting to clone or push that looks like this:
The SSH transport is a very exciting improvement to Gitblit. Aside from offering a simple password-less, public key workflow the SSH transport also allows exposes a new approach to interacting with Gitblit: SSH commands. The Gerrit and Android projects have to be thanked for providing great base SSH code that Gitblit has integrated.
You may watch an Asciinema screencast of using the SSH transport and it's command infrastructure here.
+
Cloning & Pushing
By default, Gitblit serves the SSH transport on port 29418, which is the same as Gerrit. Why was 29418 chosen? It's likely because it resembles the IANA port assigned to the git protocol (9418).
Gitblit will authenticate using username/password or public keys.
Setting up your account to use public key authentication
Public key authentication allows you to operate in a password-less workflow and to separate your web login credentials from your git credentials. Setting up public key authentication is very simple. If you are working on Windows you'll need to install Git for Windows.
First you'll need to create an SSH key pair, if you don't already have one or if you want to generate a new, separate key.
+
ssh-keygen
+
NOTE: It is important to note that ssh-keygen generates a public/private keypair (e.g. id_rsa and id_rsa.pub). You want to upload the public key, which is denoted by the .pub file extension.
+
Uploading your public key from the command-line
Then you can upload your public key right from the command-line.
Navigate to your profile page from the dropdown user menu.
+
Click the SSH Keys tab and paste your public key into the Add SSH Key form.
+
Click the Save button
+
Once you ave uploaded your public key you should be able to execute the following command without a password prompt.
+
ssh -l <username> -p 29418 <hostname>
+
+
Setting up an SSH alias
Typing the following command syntax all the time gets to be rather tedious.
+
ssh -l <username> -p 29418 <hostname>
+
You can define an alias for your server which will reduce your command syntax to something like this.
+
ssh <alias>
+
Create or modify your ~/.ssh/config file and add a host entry. If you are on Windows, you'll want to create or modify <userfolder>\.ssh\config, where userfolder is dependent on your version of Windows. Most recently this is c:\users\<userfolder>.
+
Host <alias>
+ IdentityFile ~/.ssh/id_rsa
+ User <username>
+ Port 29418
+ HostName <hostname>
+
+
SSH Commands
Gitblit supports SSH command plugins and provides several commands out-of-the-box.
+
keys
The keys command dispatcher allows you to manage your public ssh keys. You can list keys, add keys, remove keys, and identify the key in-use for the active session.
+
keys add
Add an SSH public key to your account. This command accepts a public key piped to stdin.
Show the SSH public keys you have added to your account.
+
ssh -l <username> -p 29418 <hostname> keys list
+
+
keys remove
Remove an SSH public key from your account. This command accepts several input values, the most useful one is an index number which matches the index number displayed in the list command.
You can also remove all your public keys from your account.
+
ssh -l <username> -p 29418 <hostname> keys remove ALL
+
+
keys permission
You may control the access permission for each SSH key. This is more of a safety feature than a security measure.
+
+
+
+
Permission
+
Description
+
+
+
+
+
V
+
SSH key may not be used for clone/fetch or push
+
+
+
R
+
SSH key may be used to clone/fetch
+
+
+
RW
+
SSH key may be used to clone/fetch and push
+
+
+
+
Mac OSX Fonts
Many of Gitblit's SSH commands rely on ANSI border characters to provide a pretty presentation of data. Unfortunately, the fonts provided by Apple - while very nice - don't work well with ANSI border characters. The following public domain fixed-width, fixed-point, bitmapped fonts work very nicely. I find the 6x12 font with a line spacing of ~0.8 to be quite acceptable.
Gitblit is designed to be a complete Git server solution, however you may already have a Git serving solution such as ssh+gitolite or Gerrit. For these scenarios, you may configure Gitblit to be just a repository viewer.
+
Lock-down your Viewer
Here is an example configuration that disables all administration, all Git serving features, and requires an authenticated user to view anything.
Download Gitblit WAR 1.10.0 to the webapps folder of your servlet container.
+
You may have to manually extract the WAR (zip file) to a folder within your webapps folder.
+
By default, the Gitblit webapp is configured through WEB-INF/data/gitblit.properties. Open WEB-INF/data/gitblit.properties in your favorite text editor and make sure to review and set:
+
+
git.packedGitLimit (set larger than the size of your largest repository)
Enter the default administrator credentials: admin / admin and click the Login button NOTE: Make sure to change the administrator username and/or password!!
+
+
WAR Data Location
By default, Gitblit WAR stores all data (users, settings, repositories, etc) in ${contextFolder}/WEB-INF/data. This is fine for a quick setup, but there are many reasons why you don't want to keep your data within the webapps folder of your servlet container. Specifying an alternate baseFolder also allows for simple upgrades in the future.
Choose a location that is writeable by your servlet container!
After you configure baseFolder and restart your container, Gitblit will copy the contents of the WEB-INF/data folder to your specified baseFolderIF the file ${baseFolder}/gitblit.properties does not already exist. This allows you to get going with minimal fuss.
+
Specifying baseFolder via GITBLIT_HOME
You can specify GITBLIT_HOME either as an environment variable or as a -DGITBLIT_HOME JVM system property.
+
Specifying baseFolder via web.xml
You may specify an external location for your data by directly editing WEB-INF/web.xml and manipulating the baseFolder env-entry. Your servlet container may be smart enough to recognize the change and to restart Gitblit.
+
Specifying baseFolder via JNDI
This is a better way to configure your baseFolder because it survives WAR redeploys or deployments of new versions. These directions assume you are running Tomcat as your container, other containers may have different ways to specify global JNDI environment entries.
+
+
Open TOMCAT_HOME/conf/context.xml
+
Insert an Environment node within the Context node.
Gitblit supports loading it's settings from multiple properties files. You can achieve this using the include=filename key. This setting supports loading multiple files using a comma as the delimiter. They are processed in the order defined and they may be nested (i.e. your included properties may include properties, etc, etc).
+
+
diff --git a/src/main/distrib/data/gitblit.properties b/src/main/distrib/data/gitblit.properties
deleted file mode 100644
index a4202e01b..000000000
--- a/src/main/distrib/data/gitblit.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# GITBLIT.PROPERTIES
-#
-# Define your custom settings in this file and/or include settings defined in
-# other properties files.
-#
-
-# Include Gitblit's 'defaults.properties' within your configuration.
-#
-# NOTE: Gitblit will not automatically reload "included" properties. Gitblit
-# only watches the 'gitblit.properties' file for modifications.
-#
-# Paths may be relative to the ${baseFolder} or they may be absolute.
-#
-# COMMA-DELIMITED
-# SINCE 1.7.0
-include = defaults.properties
-
-#
-# Define your overrides or custom settings below
-#
diff --git a/src/main/distrib/data/gitignore b/src/main/distrib/data/gitignore
deleted file mode 160000
index 097db81c0..000000000
--- a/src/main/distrib/data/gitignore
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 097db81c08b138dea7cb031eb18eeb16afe44bdf
diff --git a/src/main/distrib/data/groovy/.gitignore b/src/main/distrib/data/groovy/.gitignore
deleted file mode 100644
index e58dc47f6..000000000
--- a/src/main/distrib/data/groovy/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/grape
diff --git a/src/main/distrib/data/groovy/blockpush.groovy b/src/main/distrib/data/groovy/blockpush.groovy
deleted file mode 100644
index caef33060..000000000
--- a/src/main/distrib/data/groovy/blockpush.groovy
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import java.text.MessageFormat;
-
-import com.gitblit.GitBlit
-import com.gitblit.models.RepositoryModel
-import com.gitblit.models.UserModel
-import org.eclipse.jgit.transport.ReceiveCommand
-import org.eclipse.jgit.transport.ReceiveCommand.Result
-import org.slf4j.Logger
-import com.gitblit.utils.ClientLogger
-
-/**
- * Sample Gitblit Pre-Receive Hook: blockpush
- *
- * This script could and perhaps should be further developed to provide
- * a full repository-branch permissions system similar to gitolite or gitosis.
- *
- * The Pre-Receive hook is executed after an incoming push has been parsed,
- * validated, and objects have been written but BEFORE the refs are updated.
- * This is the appropriate point to block a push for some reason.
- *
- * This script is only executed when pushing to *Gitblit*, not to other Git
- * tooling you may be using.
- *
- * If this script is specified in *groovy.preReceiveScripts* of gitblit.properties
- * or web.xml then it will be executed by any repository when it receives a
- * push. If you choose to share your script then you may have to consider
- * tailoring control-flow based on repository access restrictions.
- *
- * Scripts may also be specified per-repository in the repository settings page.
- * Shared scripts will be excluded from this list of available scripts.
- *
- * This script is dynamically reloaded and it is executed within it's own
- * exception handler so it will not crash another script nor crash Gitblit.
- *
- * If you want this hook script to fail and abort all subsequent scripts in the
- * chain, "return false" at the appropriate failure points.
- *
- * Bound Variables:
- * gitblit Gitblit Server com.gitblit.GitBlit
- * repository Gitblit Repository com.gitblit.models.RepositoryModel
- * receivePack JGit Receive Pack org.eclipse.jgit.transport.ReceivePack
- * user Gitblit User com.gitblit.models.UserModel
- * commands JGit commands Collection
- * url Base url for Gitblit String
- * logger Logs messages to Gitblit org.slf4j.Logger
- * clientLogger Logs messages to Git client com.gitblit.utils.ClientLogger
- *
- * Accessing Gitblit Custom Fields:
- * def myCustomField = repository.customFields.myCustomField
- *
- */
-
-// Indicate we have started the script
-logger.info("blockpush hook triggered by ${user.username} for ${repository.name}: checking ${commands.size} commands")
-
-/*
- * Example rejection of pushes to the master branch of example.git
- */
-def blocked = false
-switch (repository.name) {
- case 'ex@mple.git':
- for (ReceiveCommand command : commands) {
- def updatedRef = command.refName
- if (updatedRef.equals('refs/heads/master')) {
- // to reject a command set it's result to anything other than Result.NOT_ATTEMPTED
- command.setResult(Result.REJECTED_OTHER_REASON, "You are not permitted to write to ${repository.name}:${updatedRef}")
- blocked = true
- }
- }
- break
-
- default:
- break
-}
-
-if (blocked) {
- // return false to break the push hook chain
- return false
-}
\ No newline at end of file
diff --git a/src/main/distrib/data/groovy/fisheye.groovy b/src/main/distrib/data/groovy/fisheye.groovy
deleted file mode 100644
index c576b36d5..000000000
--- a/src/main/distrib/data/groovy/fisheye.groovy
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import com.gitblit.GitBlit
-import com.gitblit.Keys
-import com.gitblit.models.RepositoryModel
-import com.gitblit.models.UserModel
-import com.gitblit.utils.JGitUtils
-import org.eclipse.jgit.lib.Repository
-import org.eclipse.jgit.revwalk.RevCommit
-import org.eclipse.jgit.transport.ReceiveCommand
-import org.eclipse.jgit.transport.ReceiveCommand.Result
-import org.slf4j.Logger
-
-/**
- * Sample Gitblit Post-Receive Hook: fisheye
- *
- * The Post-Receive hook is executed AFTER the pushed commits have been applied
- * to the Git repository. This is the appropriate point to trigger an
- * integration build or to send a notification.
- *
- * This script is only executed when pushing to *Gitblit*, not to other Git
- * tooling you may be using.
- *
- * If this script is specified in *groovy.postReceiveScripts* of gitblit.properties
- * or web.xml then it will be executed by any repository when it receives a
- * push. If you choose to share your script then you may have to consider
- * tailoring control-flow based on repository access restrictions.
- *
- * Scripts may also be specified per-repository in the repository settings page.
- * Shared scripts will be excluded from this list of available scripts.
- *
- * This script is dynamically reloaded and it is executed within it's own
- * exception handler so it will not crash another script nor crash Gitblit.
- *
- * Bound Variables:
- * gitblit Gitblit Server com.gitblit.GitBlit
- * repository Gitblit Repository com.gitblit.models.RepositoryModel
- * receivePack JGit Receive Pack org.eclipse.jgit.transport.ReceivePack
- * user Gitblit User com.gitblit.models.UserModel
- * commands JGit commands Collection
- * url Base url for Gitblit String
- * logger Logs messages to Gitblit org.slf4j.Logger
- * clientLogger Logs messages to Git client com.gitblit.utils.ClientLogger
- *
- * Accessing Gitblit Custom Fields:
- * def myCustomField = repository.customFields.myCustomField
- *
- */
-// Indicate we have started the script
-logger.info("fisheye hook triggered by ${user.username} for ${repository.name}")
-
-// define your fisheye url here or set groovy.fisheyeServer in
-// gitblit.properties or web.xml
-def fisheyeUrl = gitblit.getString('groovy.fisheyeServer', 'http://yourserver/jenkins')
-
-// define your fisheye API token or set groovy.fisheyeApiToken in
-// gitblit.properties or web.xml
-def fisheyeApiToken = gitblit.getString('groovy.fisheyeApiToken', '')
-
-// whether to remove .git suffix from repository name
-// may be defined in gitblit.properties or web.xml
-def fisheyeRemoveGitSuffix = gitblit.getBoolean('groovy.fisheyeRemoveGitSuffix', false)
-
-def repoName = repository.name
-if (fisheyeRemoveGitSuffix && repoName.toLowerCase().endsWith('.git')) repoName = repoName.substring(0, repoName.length() - 4)
-
-// define the trigger url
-def triggerUrl = "$fisheyeUrl/rest-service-fecru/admin/repositories-v1/$repoName/scan"
-
-// trigger the build
-def _url = new URL(triggerUrl)
-def _con = _url.openConnection()
-
-// set up connection
-_con.setRequestMethod("POST")
-_con.setRequestProperty("X-Api-Key", fisheyeApiToken)
-_con.setRequestProperty("User-Agent", "Gitblit")
-
-// send post request
-_con.setDoOutput(true)
-
-logger.info("fisheye response code: ${_con.responseCode}")
diff --git a/src/main/distrib/data/groovy/fogbugz.groovy b/src/main/distrib/data/groovy/fogbugz.groovy
deleted file mode 100644
index 4c19d3dae..000000000
--- a/src/main/distrib/data/groovy/fogbugz.groovy
+++ /dev/null
@@ -1,167 +0,0 @@
-import org.eclipse.jgit.revwalk.RevCommit;
-
-/*
- * Copyright 2013 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import com.gitblit.GitBlit
-import com.gitblit.Keys
-import com.gitblit.models.RepositoryModel
-import com.gitblit.models.TeamModel
-import com.gitblit.models.UserModel
-import com.gitblit.utils.JGitUtils
-import com.sun.org.apache.xalan.internal.xsltc.compiler.Import;
-
-import java.text.SimpleDateFormat
-import org.eclipse.jgit.lib.Repository
-import org.eclipse.jgit.lib.Config
-import org.eclipse.jgit.revwalk.RevCommit
-import org.eclipse.jgit.transport.ReceiveCommand
-import org.eclipse.jgit.transport.ReceiveCommand.Result
-import org.slf4j.Logger
-
-import org.eclipse.jgit.api.Status;
-import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.diff.DiffEntry;
-import org.eclipse.jgit.diff.DiffFormatter;
-import org.eclipse.jgit.diff.RawTextComparator;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.IndexDiff;
-import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.patch.FileHeader;
-import org.eclipse.jgit.revwalk.RevWalk;
-import org.eclipse.jgit.treewalk.FileTreeIterator;
-import org.eclipse.jgit.treewalk.EmptyTreeIterator;
-import org.eclipse.jgit.treewalk.CanonicalTreeParser;
-import org.eclipse.jgit.util.io.DisabledOutputStream;
-
-import java.util.Set;
-import java.util.HashSet;
-
-/**
- * Sample Gitblit Post-Receive Hook: fogbugz
- *
- * The purpose of this script is to invoke the Fogbugz API and update a case when
- * push is received based.
- *
- * Example URL - http://bugs.yourdomain.com/fogbugz/cvsSubmit.asp?ixBug=bugID&sFile=file&sPrev=x&sNew=y&ixRepository=206
- *
- * The Post-Receive hook is executed AFTER the pushed commits have been applied
- * to the Git repository. This is the appropriate point to trigger an
- * integration build or to send a notification.
- *
- * This script is only executed when pushing to *Gitblit*, not to other Git
- * tooling you may be using.
- *
- * If this script is specified in *groovy.postReceiveScripts* of gitblit.properties
- * or web.xml then it will be executed by any repository when it receives a
- * push. If you choose to share your script then you may have to consider
- * tailoring control-flow based on repository access restrictions.
- *
- * Scripts may also be specified per-repository in the repository settings page.
- * Shared scripts will be excluded from this list of available scripts.
- *
- * This script is dynamically reloaded and it is executed within it's own
- * exception handler so it will not crash another script nor crash Gitblit.
- *
- * If you want this hook script to fail and abort all subsequent scripts in the
- * chain, "return false" at the appropriate failure points.
- *
- * Bound Variables:
- * gitblit Gitblit Server com.gitblit.GitBlit
- * repository Gitblit Repository com.gitblit.models.RepositoryModel
- * receivePack JGit Receive Pack org.eclipse.jgit.transport.ReceivePack
- * user Gitblit User com.gitblit.models.UserModel
- * commands JGit commands Collection
- * url Base url for Gitblit String
- * logger Logs messages to Gitblit org.slf4j.Logger
- * clientLogger Logs messages to Git client com.gitblit.utils.ClientLogger
- *
- * Accessing Gitblit Custom Fields:
- * def myCustomField = repository.customFields.myCustomField
- *
- * Cusom Fileds Used by This script
- * fogbugzUrl - base URL to Fogbugz (ie. https://bugs.yourdomain.com/fogbugz/)
- * fogbugzRepositoryId - (ixRepository value from Fogbugz Source Control configuration screen)
- * fogbugzCommitMessageRegex - regex pattern used to match on bug id
- */
-
-// Indicate we have started the script
-logger.info("fogbugz hook triggered by ${user.username} for ${repository.name}")
-
-/*
- * Primitive email notification.
- * This requires the mail settings to be properly configured in Gitblit.
- */
-
-Repository r = gitblit.getRepository(repository.name)
-
-// pull custom fields from repository specific values
-// groovy.customFields = "fogbugzUrl=Fogbugz Base URL" "fogbugzRepositoryId=Fogbugz Repository ID" "fogbugzCommitMessageRegex="Fogbugz Commit Message Regular Expression"
-def fogbugzUrl = repository.customFields.fogbugzUrl
-def fogbugzRepositoryId = repository.customFields.fogbugzRepositoryId
-def bugIdRegex = repository.customFields.fogbugzCommitMessageRegex
-
-for (command in commands) {
-
- for( commit in JGitUtils.getRevLog(r, command.oldId.name, command.newId.name).reverse() ) {
- // Example URL - http://bugs.salsalabs.com/fogbugz/cvsSubmit.asp?ixBug=bugID&sFile=file&sPrev=x&sNew=y&ixRepository=206
- def bugIds = [];
- // Grab the second matcher and then filter out each numeric ID and add it to array
- (commit.getFullMessage() =~ bugIdRegex).each{ (it[1] =~ "\\d+").each {bugIds.add(it)} }
-
- for( file in getFiles(r, commit) ) {
- for( bugId in bugIds ) {
- def url = "${fogbugzUrl}/cvsSubmit.asp?ixBug=${bugId}&sFile=${file}&sPrev=${command.oldId.name}&sNew=${command.newId.name}&ixRepository=${fogbugzRepositoryId}"
- logger.info( url );
- // Hit the page and make sure we get an "OK" response
- def responseString = new URL(url).getText()
- if( !"OK".equals(responseString) ) {
- throw new Exception( "Problem posting ${url} - ${responseString}" );
- }
- }
- }
- }
-}
-// close the repository reference
-r.close()
-
-/**
- * For a given commit, find all files part of it.
- */
-def Set getFiles(Repository r, RevCommit commit) {
- DiffFormatter formatter = new DiffFormatter(DisabledOutputStream.INSTANCE)
- formatter.setRepository(r)
- formatter.setDetectRenames(true)
- formatter.setDiffComparator(RawTextComparator.DEFAULT);
-
- def diffs
- RevWalk rw = new RevWalk(r)
- if (commit.parentCount > 0) {
- RevCommit parent = rw.parseCommit(commit.parents[0].id)
- diffs = formatter.scan(parent.tree, commit.tree)
- } else {
- diffs = formatter.scan(new EmptyTreeIterator(),
- new CanonicalTreeParser(null, rw.objectReader, commit.tree))
- }
- rw.dispose()
-
- // Grab each filepath
- Set fileNameSet = new HashSet( diffs.size() );
- for (DiffEntry entry in diffs) {
- FileHeader header = formatter.toFileHeader(entry)
- fileNameSet.add( header.newPath )
- }
- return fileNameSet;
-}
\ No newline at end of file
diff --git a/src/main/distrib/data/groovy/jenkins.groovy b/src/main/distrib/data/groovy/jenkins.groovy
deleted file mode 100644
index 7f88eb901..000000000
--- a/src/main/distrib/data/groovy/jenkins.groovy
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import com.gitblit.GitBlit
-import com.gitblit.Keys
-import com.gitblit.models.RepositoryModel
-import com.gitblit.models.UserModel
-import com.gitblit.utils.JGitUtils
-import org.eclipse.jgit.lib.Repository
-import org.eclipse.jgit.revwalk.RevCommit
-import org.eclipse.jgit.transport.ReceiveCommand
-import org.eclipse.jgit.transport.ReceiveCommand.Result
-import org.slf4j.Logger
-
-/**
- * Sample Gitblit Post-Receive Hook: jenkins
- *
- * The Post-Receive hook is executed AFTER the pushed commits have been applied
- * to the Git repository. This is the appropriate point to trigger an
- * integration build or to send a notification.
- *
- * This script is only executed when pushing to *Gitblit*, not to other Git
- * tooling you may be using.
- *
- * If this script is specified in *groovy.postReceiveScripts* of gitblit.properties
- * or web.xml then it will be executed by any repository when it receives a
- * push. If you choose to share your script then you may have to consider
- * tailoring control-flow based on repository access restrictions.
- *
- * Scripts may also be specified per-repository in the repository settings page.
- * Shared scripts will be excluded from this list of available scripts.
- *
- * This script is dynamically reloaded and it is executed within it's own
- * exception handler so it will not crash another script nor crash Gitblit.
- *
- * Bound Variables:
- * gitblit Gitblit Server com.gitblit.GitBlit
- * repository Gitblit Repository com.gitblit.models.RepositoryModel
- * receivePack JGit Receive Pack org.eclipse.jgit.transport.ReceivePack
- * user Gitblit User com.gitblit.models.UserModel
- * commands JGit commands Collection
- * url Base url for Gitblit String
- * logger Logs messages to Gitblit org.slf4j.Logger
- * clientLogger Logs messages to Git client com.gitblit.utils.ClientLogger
- *
- * Accessing Gitblit Custom Fields:
- * def myCustomField = repository.customFields.myCustomField
- *
- */
-// Indicate we have started the script
-logger.info("jenkins hook triggered by ${user.username} for ${repository.name}")
-
-// This script requires Jenkins Git plugin 1.1.14 or later
-// http://kohsuke.org/2011/12/01/polling-must-die-triggering-jenkins-builds-from-a-git-hook/
-
-// define your jenkins url here or set groovy.jenkinsServer in
-// gitblit.properties or web.xml
-def jenkinsUrl = gitblit.getString('groovy.jenkinsServer', 'http://yourserver/jenkins')
-
-// define your jenkins access token here or set groovy.jenkinsToken in
-// gitblit.properties or web.xml (https://github.com/jenkinsci/git-plugin/#push-notification-from-repository)
-def jenkinsToken = gitblit.getString('groovy.jenkinsToken', 'yourtoken')
-
-// define the repository base url
-def jenkinsGitbaseurl = gitblit.getString('groovy.jenkinsGitbaseurl', "${url}/r")
-
-// define the trigger url
-def triggerUrl = jenkinsUrl + "/git/notifyCommit?url=" + jenkinsGitbaseurl + "/${repository.name}" + "&token=" + jenkinsToken
-
-// trigger the build
-new URL(triggerUrl).getContent()
diff --git a/src/main/distrib/data/groovy/localclone.groovy b/src/main/distrib/data/groovy/localclone.groovy
deleted file mode 100644
index 14ddbf9b3..000000000
--- a/src/main/distrib/data/groovy/localclone.groovy
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2012 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import com.gitblit.GitBlit
-import com.gitblit.Keys
-import com.gitblit.models.RepositoryModel
-import com.gitblit.models.TeamModel
-import com.gitblit.models.UserModel
-import com.gitblit.utils.JGitUtils
-import com.gitblit.utils.StringUtils
-import java.text.SimpleDateFormat
-import org.eclipse.jgit.api.CloneCommand
-import org.eclipse.jgit.api.Git
-import org.eclipse.jgit.lib.Repository
-import org.eclipse.jgit.lib.Config
-import org.eclipse.jgit.revwalk.RevCommit
-import org.eclipse.jgit.transport.ReceiveCommand
-import org.eclipse.jgit.transport.ReceiveCommand.Result
-import org.eclipse.jgit.util.FileUtils
-import org.slf4j.Logger
-
-/**
- * Sample Gitblit Post-Receive Hook: localclone
- *
- * The Post-Receive hook is executed AFTER the pushed commits have been applied
- * to the Git repository. This is the appropriate point to trigger an
- * integration build or to send a notification.
- *
- * This script is only executed when pushing to *Gitblit*, not to other Git
- * tooling you may be using.
- *
- * If this script is specified in *groovy.postReceiveScripts* of gitblit.properties
- * or web.xml then it will be executed by any repository when it receives a
- * push. If you choose to share your script then you may have to consider
- * tailoring control-flow based on repository access restrictions.
- *
- * Scripts may also be specified per-repository in the repository settings page.
- * Shared scripts will be excluded from this list of available scripts.
- *
- * This script is dynamically reloaded and it is executed within it's own
- * exception handler so it will not crash another script nor crash Gitblit.
- *
- * If you want this hook script to fail and abort all subsequent scripts in the
- * chain, "return false" at the appropriate failure points.
- *
- * Bound Variables:
- * gitblit Gitblit Server com.gitblit.GitBlit
- * repository Gitblit Repository com.gitblit.models.RepositoryModel
- * receivePack JGit Receive Pack org.eclipse.jgit.transport.ReceivePack
- * user Gitblit User com.gitblit.models.UserModel
- * commands JGit commands Collection
- * url Base url for Gitblit String
- * logger Logs messages to Gitblit org.slf4j.Logger
- * clientLogger Logs messages to Git client com.gitblit.utils.ClientLogger
- *
- * Accessing Gitblit Custom Fields:
- * def myCustomField = repository.customFields.myCustomField
- *
- */
-
-// Indicate we have started the script
-logger.info("localclone hook triggered by ${user.username} for ${repository.name}")
-
-def rootFolder = 'c:/test'
-def bare = false
-def cloneAllBranches = true
-def cloneBranch = 'refs/heads/master'
-def includeSubmodules = true
-
-def repoName = repository.name
-def destinationFolder = new File(rootFolder, StringUtils.stripDotGit(repoName))
-def srcUrl = 'file://' + new File(gitblit.getRepositoriesFolder(), repoName).absolutePath
-
-// delete any previous clone
-if (destinationFolder.exists()) {
- FileUtils.delete(destinationFolder, FileUtils.RECURSIVE)
-}
-
-// clone the repository
-logger.info("cloning ${srcUrl} to ${destinationFolder}")
-CloneCommand cmd = Git.cloneRepository();
-cmd.setBare(bare)
-if (cloneAllBranches)
- cmd.setCloneAllBranches(true)
-else
- cmd.setBranch(cloneBranch)
-cmd.setCloneSubmodules(includeSubmodules)
-cmd.setURI(srcUrl)
-cmd.setDirectory(destinationFolder)
-Git git = cmd.call();
-git.repository.close()
-
-// report clone operation success back to pushing Git client
-clientLogger.info("${repoName} cloned to ${destinationFolder}")
\ No newline at end of file
diff --git a/src/main/distrib/data/groovy/protect-refs.groovy b/src/main/distrib/data/groovy/protect-refs.groovy
deleted file mode 100644
index b1b611f44..000000000
--- a/src/main/distrib/data/groovy/protect-refs.groovy
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2012 Philip L. McMahon.
- *
- * Derived from blockpush.groovy, copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import com.gitblit.GitBlit
-import com.gitblit.models.RepositoryModel
-import com.gitblit.models.UserModel
-
-import org.eclipse.jgit.transport.ReceiveCommand
-import org.eclipse.jgit.transport.ReceiveCommand.Result
-import org.slf4j.Logger
-
-/**
- * Sample Gitblit Pre-Receive Hook: protect-refs
- *
- * This script provides basic authorization of receive command types for a list
- * of known ref patterns. Command types and unmatched ref patterns will be
- * ignored, meaning this script has an "allow by default" policy.
- *
- * This script works best when a repository requires authentication on push, but
- * can be used to enforce fast-forward commits or prohibit ref deletion by
- * setting the *authorizedTeams* variable to an empty list and adding a ".+"
- * entry to the *protectedRefs* list.
- *
- * The Pre-Receive hook is executed after an incoming push has been parsed,
- * validated, and objects have been written but BEFORE the refs are updated.
- * This is the appropriate point to block a push for some reason.
- *
- * This script is only executed when pushing to *Gitblit*, not to other Git
- * tooling you may be using.
- *
- * If this script is specified in *groovy.preReceiveScripts* of gitblit.properties
- * or web.xml then it will be executed by any repository when it receives a
- * push. If you choose to share your script then you may have to consider
- * tailoring control-flow based on repository access restrictions.
- *
- * Scripts may also be specified per-repository in the repository settings page.
- * Shared scripts will be excluded from this list of available scripts.
- *
- * This script is dynamically reloaded and it is executed within it's own
- * exception handler so it will not crash another script nor crash Gitblit.
- *
- * This script may reject one or more commands, but will never return false.
- * Subsequent scripts, if any, will always be invoked.
- *
- * Bound Variables:
- * gitblit Gitblit Server com.gitblit.GitBlit
- * repository Gitblit Repository com.gitblit.models.RepositoryModel
- * receivePack JGit Receive Pack org.eclipse.jgit.transport.ReceivePack
- * user Gitblit User com.gitblit.models.UserModel
- * commands JGit commands Collection
- * url Base url for Gitblit String
- * logger Logs messages to Gitblit org.slf4j.Logger
- * clientLogger Logs messages to Git client com.gitblit.utils.ClientLogger
- *
- * Accessing Gitblit Custom Fields:
- * def myCustomField = repository.customFields.myCustomField
- *
- */
-
-// map of protected command types to returned results type
-// commands not included will skip authz check
-def protectedCmds = [
- UPDATE_NONFASTFORWARD: Result.REJECTED_NONFASTFORWARD,
- DELETE: Result.REJECTED_NODELETE
-]
-
-// list of regex patterns for protected refs
-def protectedRefs = [
- "refs/heads/master",
- "refs/tags/.+"
-]
-
-// teams which are authorized to perform protected commands on protected refs
-def authorizedTeams = [ "admins" ]
-
-for (ReceiveCommand command : commands) {
- def updateType = command.type
- def updatedRef = command.refName
-
- // find first regex which matches updated ref, if any
- def refPattern = protectedRefs.find { updatedRef.matches ~it }
-
- // find rejection result for update type, if any
- def result = protectedCmds[updateType.name()]
-
- // command requires authz if ref is protected and has a mapped rejection result
- if (refPattern && result) {
-
- // verify user is a member of any authorized team
- def team = authorizedTeams.find { user.isTeamMember it }
- if (team) {
- // don't adjust command result
- logger.info "${user.username} authorized for ${updateType} of protected ref ${repository.name}:${updatedRef} (${command.oldId.name} -> ${command.newId.name})"
- } else {
- // mark command result as rejected
- command.setResult(result, "${user.username} cannot ${updateType} protected ref ${repository.name}:${updatedRef} matching pattern ${refPattern}")
- }
- }
-}
diff --git a/src/main/distrib/data/groovy/redmine-fetch.groovy b/src/main/distrib/data/groovy/redmine-fetch.groovy
deleted file mode 100644
index 607383533..000000000
--- a/src/main/distrib/data/groovy/redmine-fetch.groovy
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2014 Berke Viktor.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import com.gitblit.GitBlit
-import com.gitblit.Keys
-import com.gitblit.models.RepositoryModel
-import com.gitblit.models.UserModel
-import com.gitblit.utils.JGitUtils
-import org.eclipse.jgit.lib.Repository
-import org.slf4j.Logger
-
-/*
- * This script triggers automatic repo fetches in Redmine upon pushes.
- * It won't work out-of-box, you need to configure a few things.
- *
- * Redmine
- * - Go to Administration / Settings / Repositories, and make sure that the
- * "Enable WS for repository management" option is checked. Also generate an
- * API key and take note of it.
- * - Open a project page, go to Settings / Repositories and add a repo. Take
- * note of the Identifier.
- *
- * Gitblit
- * - Set the redmineProject custom field in gitblit.properties, e.g.
- * groovy.customFields = "redmineProject=Redmine Project Identifier"
- * - Edit the repo you added to Redmine, go to hook scripts and add this script
- * to the post-receive hooks. Also specify the Redmine project's identifier
- * under custom fields.
- *
- * Troubleshooting
- * - run Gitblit interactively and check its console output
- * - on the Redmine server, tail -f log/access.log
- *
- * If you want your repos to work with multiple Redmine projects, you don't need
- * to add the repos to all of them. Instead, add the repo to a single project,
- * then go to Administration / Settings / Repositories and enable the "Allow
- * issues of all the other projects to be referenced and fixed" option.
- */
-
-/* specify the URL of your Redmine instance here */
-def redmineURL = "http://redmine.foo.bar/"
-
-/* specify the API key you generated in Redmine Administration here */
-def apiKey = "FIXME"
-
-/*
- * construct the URL from global and repo properties, for more info refer to
- * http://www.redmine.org/projects/redmine/wiki/RedmineSettings#Fetch-commits-automatically
- */
-def triggerURL = redmineURL + "sys/fetch_changesets?id=" + repository.customFields.redmineProject + "&key=" + apiKey
-
-/* log the action */
-logger.info("Redmine Fetch hook triggered by ${user.username} for ${repository.name}: GET ${triggerURL}")
-
-/* send the HTTP GET query */
-new URL(triggerURL).getContent()
diff --git a/src/main/distrib/data/groovy/sendmail-html.groovy b/src/main/distrib/data/groovy/sendmail-html.groovy
deleted file mode 100644
index 305c64041..000000000
--- a/src/main/distrib/data/groovy/sendmail-html.groovy
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * Copyright 2012 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import com.gitblit.GitBlit
-import com.gitblit.Keys
-import com.gitblit.models.RepositoryModel
-import com.gitblit.models.TeamModel
-import com.gitblit.models.UserModel
-import com.gitblit.utils.JGitUtils
-import java.text.SimpleDateFormat
-
-import org.eclipse.jgit.api.Status;
-import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.diff.DiffEntry;
-import org.eclipse.jgit.diff.DiffFormatter;
-import org.eclipse.jgit.diff.RawTextComparator;
-import org.eclipse.jgit.diff.DiffEntry.ChangeType;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.IndexDiff;
-import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.Repository
-import org.eclipse.jgit.lib.Config
-import org.eclipse.jgit.patch.FileHeader;
-import org.eclipse.jgit.revwalk.RevCommit
-import org.eclipse.jgit.revwalk.RevWalk;
-import org.eclipse.jgit.transport.ReceiveCommand
-import org.eclipse.jgit.transport.ReceiveCommand.Result
-import org.eclipse.jgit.treewalk.FileTreeIterator;
-import org.eclipse.jgit.treewalk.EmptyTreeIterator;
-import org.eclipse.jgit.treewalk.CanonicalTreeParser;
-import org.eclipse.jgit.util.io.DisabledOutputStream;
-import org.slf4j.Logger
-import groovy.xml.MarkupBuilder
-
-import java.io.IOException;
-import java.security.MessageDigest
-
-
-/**
- * Sample Gitblit Post-Receive Hook: sendmail-html
- *
- * The Post-Receive hook is executed AFTER the pushed commits have been applied
- * to the Git repository. This is the appropriate point to trigger an
- * integration build or to send a notification.
- *
- * This script is only executed when pushing to *Gitblit*, not to other Git
- * tooling you may be using.
- *
- * If this script is specified in *groovy.postReceiveScripts* of gitblit.properties
- * or web.xml then it will be executed by any repository when it receives a
- * push. If you choose to share your script then you may have to consider
- * tailoring control-flow based on repository access restrictions.
- *
- * Scripts may also be specified per-repository in the repository settings page.
- * Shared scripts will be excluded from this list of available scripts.
- *
- * This script is dynamically reloaded and it is executed within it's own
- * exception handler so it will not crash another script nor crash Gitblit.
- *
- * If you want this hook script to fail and abort all subsequent scripts in the
- * chain, "return false" at the appropriate failure points.
- *
- * Bound Variables:
- * gitblit Gitblit Server com.gitblit.GitBlit
- * repository Gitblit Repository com.gitblit.models.RepositoryModel
- * user Gitblit User com.gitblit.models.UserModel
- * commands JGit commands Collection
- * url Base url for Gitblit java.lang.String
- * logger Logs messages to Gitblit org.slf4j.Logger
- * clientLogger Logs messages to Git client com.gitblit.utils.ClientLogger
- *
- * Accessing Gitblit Custom Fields:
- * def myCustomField = repository.customFields.myCustomField
- *
- */
-
-com.gitblit.models.UserModel userModel = user
-
-// Indicate we have started the script
-logger.info("sendmail-html hook triggered by ${user.username} for ${repository.name}")
-
-/*
- * Primitive email notification.
- * This requires the mail settings to be properly configured in Gitblit.
- */
-
-Repository r = gitblit.getRepository(repository.name)
-
-// reuse existing repository config settings, if available
-Config config = r.getConfig()
-def mailinglist = config.getString('hooks', null, 'mailinglist')
-def emailprefix = config.getString('hooks', null, 'emailprefix')
-
-// set default values
-def toAddresses = []
-if (emailprefix == null) {
- emailprefix = '[Gitblit]'
-}
-
-if (mailinglist != null) {
- def addrs = mailinglist.split(/(,|\s)/)
- toAddresses.addAll(addrs)
-}
-
-// add all mailing lists defined in gitblit.properties or web.xml
-toAddresses.addAll(gitblit.getStrings(Keys.mail.mailingLists))
-
-// add all team mailing lists
-def teams = gitblit.getRepositoryTeams(repository)
-for (team in teams) {
- TeamModel model = gitblit.getTeamModel(team)
- if (model.mailingLists) {
- toAddresses.addAll(model.mailingLists)
- }
-}
-
-// add all mailing lists for the repository
-toAddresses.addAll(repository.mailingLists)
-
-// define the summary and commit urls
-def repo = repository.name
-def summaryUrl = url + "/summary?r=$repo"
-def baseCommitUrl = url + "/commit?r=$repo&h="
-def baseBlobDiffUrl = url + "/blobdiff/?r=$repo&h="
-def baseCommitDiffUrl = url + "/commitdiff/?r=$repo&h="
-def forwardSlashChar = gitblit.getString(Keys.web.forwardSlashCharacter, '/')
-
-if (gitblit.getBoolean(Keys.web.mountParameters, true)) {
- repo = repo.replace('/', forwardSlashChar).replace('/', '%2F')
- summaryUrl = url + "/summary/$repo"
- baseCommitUrl = url + "/commit/$repo/"
- baseBlobDiffUrl = url + "/blobdiff/$repo/"
- baseCommitDiffUrl = url + "/commitdiff/$repo/"
-}
-
-class HtmlMailWriter {
- Repository repository
- def url
- def baseCommitUrl
- def baseCommitDiffUrl
- def baseBlobDiffUrl
- def mountParameters
- def forwardSlashChar
- def includeGravatar
- def shortCommitIdLength
- def commitCount = 0
- def commands
- def writer = new StringWriter();
- def builder = new MarkupBuilder(writer)
-
- def writeStyle() {
- builder.style(type:"text/css", '''
- .table td {
- vertical-align: middle;
- }
- tr.noborder td {
- border: none;
- padding-top: 0px;
- }
- .gravatar-column {
- width: 5%;
- }
- .author-column {
- width: 20%;
- }
- .commit-column {
- width: 5%;
- }
- .status-column {
- width: 10%;
- }
- .table-disable-hover.table tbody tr:hover td,
- .table-disable-hover.table tbody tr:hover th {
- background-color: inherit;
- }
- .table-disable-hover.table-striped tbody tr:nth-child(odd):hover td,
- .table-disable-hover.table-striped tbody tr:nth-child(odd):hover th {
- background-color: #f9f9f9;
- }
- ''')
- }
-
- def writeBranchTitle(type, name, action, number) {
- builder.div('class' : 'pageTitle') {
- builder.span('class':'project') {
- mkp.yield "$type "
- span('class': 'repository', name )
- if (number > 0) {
- mkp.yield " $action ($number commits)"
- } else {
- mkp.yield " $action"
- }
- }
- }
- }
-
- def writeBranchDeletedTitle(type, name) {
- builder.div('class' : 'pageTitle', 'style':'color:red') {
- builder.span('class':'project') {
- mkp.yield "$type "
- span('class': 'repository', name )
- mkp.yield " deleted"
- }
- }
- }
-
- def commitUrl(RevCommit commit) {
- "${baseCommitUrl}$commit.id.name"
- }
-
- def commitDiffUrl(RevCommit commit) {
- "${baseCommitDiffUrl}$commit.id.name"
- }
-
- def encoded(String path) {
- path.replace('/', forwardSlashChar).replace('/', '%2F')
- }
-
- def blobDiffUrl(objectId, path) {
- if (mountParameters) {
- // REST style
- "${baseBlobDiffUrl}${objectId.name()}/${encoded(path)}"
- } else {
- "${baseBlobDiffUrl}${objectId.name()}&f=${path}"
- }
-
- }
-
- def writeCommitTable(commits, includeChangedPaths=true) {
- // Write commits table
- builder.table('class':"table table-disable-hover") {
- thead {
- tr {
- th(colspan: includeGravatar ? 2 : 1, "Author")
- th( "Commit" )
- th( "Message" )
- }
- }
- tbody() {
-
- // Write all the commits
- for (commit in commits) {
- writeCommit(commit)
-
- if (includeChangedPaths) {
- // Write detail on that particular commit
- tr('class' : 'noborder') {
- td (colspan: includeGravatar ? 3 : 2)
- td (colspan:2) { writeStatusTable(commit) }
- }
- }
- }
- }
- }
- }
-
- def writeCommit(commit) {
- def abbreviated = repository.newObjectReader().abbreviate(commit.id, shortCommitIdLength).name()
- def author = commit.authorIdent.name
- def email = commit.authorIdent.emailAddress
- def message = commit.shortMessage
- builder.tr {
- if (includeGravatar) {
- td('class':"gravatar-column") {
- img(src:gravatarUrl(email), 'class':"gravatar")
- }
- }
- td('class':"author-column", author)
- td('class':"commit-column") {
- a(href:commitUrl(commit)) {
- span('class':"label label-info", abbreviated )
- }
- }
- td {
- mkp.yield message
- a('class':'link', href:commitDiffUrl(commit), " [commitdiff]" )
- }
- }
- }
-
- def writeStatusLabel(style, tooltip) {
- builder.span('class' : style, 'title' : tooltip )
- }
-
- def writeAddStatusLine(ObjectId id, FileHeader header) {
- builder.td('class':'changeType') {
- writeStatusLabel("addition", "addition")
- }
- builder.td {
- a(href:blobDiffUrl(id, header.newPath), header.newPath)
- }
- }
-
- def writeCopyStatusLine(ObjectId id, FileHeader header) {
- builder.td('class':'changeType') {
- writeStatusLabel("rename", "rename")
- }
- builder.td() {
- a(href:blobDiffUrl(id, header.newPath), header.oldPath + " copied to " + header.newPath)
- }
- }
-
- def writeDeleteStatusLine(ObjectId id, FileHeader header) {
- builder.td('class':'changeType') {
- writeStatusLabel("deletion", "deletion")
- }
- builder.td() {
- a(href:blobDiffUrl(id, header.oldPath), header.oldPath)
- }
- }
-
- def writeModifyStatusLine(ObjectId id, FileHeader header) {
- builder.td('class':'changeType') {
- writeStatusLabel("modification", "modification")
- }
- builder.td() {
- a(href:blobDiffUrl(id, header.oldPath), header.oldPath)
- }
- }
-
- def writeRenameStatusLine(ObjectId id, FileHeader header) {
- builder.td('class':'changeType') {
- writeStatusLabel("rename", "rename")
- }
- builder.td() {
- mkp.yield header.oldPath
- mkp.yieldUnescaped " -> "
- a(href:blobDiffUrl(id, header.newPath), header.newPath)
- }
- }
-
- def writeStatusLine(ObjectId id, FileHeader header) {
- builder.tr {
- switch (header.changeType) {
- case ChangeType.ADD:
- writeAddStatusLine(id, header)
- break;
- case ChangeType.COPY:
- writeCopyStatusLine(id, header)
- break;
- case ChangeType.DELETE:
- writeDeleteStatusLine(id, header)
- break;
- case ChangeType.MODIFY:
- writeModifyStatusLine(id, header)
- break;
- case ChangeType.RENAME:
- writeRenameStatusLine(id, header)
- break;
- }
- }
- }
-
- def writeStatusTable(RevCommit commit) {
- DiffFormatter formatter = new DiffFormatter(DisabledOutputStream.INSTANCE)
- formatter.setRepository(repository)
- formatter.setDetectRenames(true)
- formatter.setDiffComparator(RawTextComparator.DEFAULT);
-
- def diffs
- RevWalk rw = new RevWalk(repository)
- if (commit.parentCount > 0) {
- RevCommit parent = rw.parseCommit(commit.parents[0].id)
- diffs = formatter.scan(parent.tree, commit.tree)
- } else {
- diffs = formatter.scan(new EmptyTreeIterator(),
- new CanonicalTreeParser(null, rw.objectReader, commit.tree))
- }
- rw.dispose()
- // Write status table
- builder.table('class':"plain") {
- tbody() {
- for (DiffEntry entry in diffs) {
- FileHeader header = formatter.toFileHeader(entry)
- writeStatusLine(commit.id, header)
- }
- }
- }
- }
-
-
- def md5(text) {
-
- def digest = MessageDigest.getInstance("MD5")
-
- //Quick MD5 of text
- def hash = new BigInteger(1, digest.digest(text.getBytes()))
- .toString(16)
- .padLeft(32, "0")
- hash.toString()
- }
-
- def gravatarUrl(email) {
- def cleaned = email.trim().toLowerCase()
- "http://www.gravatar.com/avatar/${md5(cleaned)}?s=30"
- }
-
- def writeNavbar() {
- builder.div('class':"navbar navbar-fixed-top") {
- div('class':"navbar-inner") {
- div('class':"container") {
- a('class':"brand", href:"${url}", title:"GitBlit") {
- img(src:"${url}/gitblt_25_white.png",
- width:"79",
- height:"25",
- 'class':"logo")
- }
- }
- }
- }
- }
-
- def write() {
- builder.html {
- head {
- link(rel:"stylesheet", href:"${url}/bootstrap/css/bootstrap.css")
- link(rel:"stylesheet", href:"${url}/gitblit.css")
- link(rel:"stylesheet", href:"${url}/bootstrap/css/bootstrap-responsive.css")
- writeStyle()
- }
- body {
-
- writeNavbar()
-
- div('class':"container") {
-
- for (command in commands) {
- def ref = command.refName
- def refType = 'Branch'
- if (ref.startsWith('refs/heads/')) {
- ref = command.refName.substring('refs/heads/'.length())
- } else if (ref.startsWith('refs/tags/')) {
- ref = command.refName.substring('refs/tags/'.length())
- refType = 'Tag'
- }
-
- switch (command.type) {
- case ReceiveCommand.Type.CREATE:
- def commits = JGitUtils.getRevLog(repository, command.oldId.name, command.newId.name).reverse()
- commitCount += commits.size()
- if (refType == 'Branch') {
- // new branch
- writeBranchTitle(refType, ref, "created", commits.size())
- writeCommitTable(commits, true)
- } else {
- // new tag
- writeBranchTitle(refType, ref, "created", 0)
- writeCommitTable(commits, false)
- }
- break
- case ReceiveCommand.Type.UPDATE:
- def commits = JGitUtils.getRevLog(repository, command.oldId.name, command.newId.name).reverse()
- commitCount += commits.size()
- // fast-forward branch commits table
- // Write header
- writeBranchTitle(refType, ref, "updated", commits.size())
- writeCommitTable(commits)
- break
- case ReceiveCommand.Type.UPDATE_NONFASTFORWARD:
- def commits = JGitUtils.getRevLog(repository, command.oldId.name, command.newId.name).reverse()
- commitCount += commits.size()
- // non-fast-forward branch commits table
- // Write header
- writeBranchTitle(refType, ref, "updated [NON fast-forward]", commits.size())
- writeCommitTable(commits)
- break
- case ReceiveCommand.Type.DELETE:
- // deleted branch/tag
- writeBranchDeletedTitle(refType, ref)
- break
- default:
- break
- }
- }
- }
- }
- }
- writer.toString()
- }
-
-}
-
-def mailWriter = new HtmlMailWriter()
-mailWriter.repository = r
-mailWriter.baseCommitUrl = baseCommitUrl
-mailWriter.baseBlobDiffUrl = baseBlobDiffUrl
-mailWriter.baseCommitDiffUrl = baseCommitDiffUrl
-mailWriter.forwardSlashChar = forwardSlashChar
-mailWriter.commands = commands
-mailWriter.url = url
-mailWriter.mountParameters = gitblit.getBoolean(Keys.web.mountParameters, true)
-mailWriter.includeGravatar = gitblit.getBoolean(Keys.web.allowGravatar, true)
-mailWriter.shortCommitIdLength = gitblit.getInteger(Keys.web.shortCommitIdLength, 8)
-
-def content = mailWriter.write()
-
-// close the repository reference
-r.close()
-
-// tell Gitblit to send the message (Gitblit filters duplicate addresses)
-def repositoryName = repository.name.substring(0, repository.name.length() - 4)
-gitblit.sendHtmlMail("${emailprefix} ${userModel.displayName} pushed ${mailWriter.commitCount} commits => $repositoryName",
- content,
- toAddresses)
diff --git a/src/main/distrib/data/groovy/sendmail.groovy b/src/main/distrib/data/groovy/sendmail.groovy
deleted file mode 100644
index c832bc64b..000000000
--- a/src/main/distrib/data/groovy/sendmail.groovy
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import com.gitblit.GitBlit
-import com.gitblit.Keys
-import com.gitblit.models.RepositoryModel
-import com.gitblit.models.TeamModel
-import com.gitblit.models.UserModel
-import com.gitblit.utils.JGitUtils
-import java.text.SimpleDateFormat
-import org.eclipse.jgit.lib.Repository
-import org.eclipse.jgit.lib.Config
-import org.eclipse.jgit.revwalk.RevCommit
-import org.eclipse.jgit.transport.ReceiveCommand
-import org.eclipse.jgit.transport.ReceiveCommand.Result
-import org.slf4j.Logger
-
-/**
- * Sample Gitblit Post-Receive Hook: sendmail
- *
- * The Post-Receive hook is executed AFTER the pushed commits have been applied
- * to the Git repository. This is the appropriate point to trigger an
- * integration build or to send a notification.
- *
- * This script is only executed when pushing to *Gitblit*, not to other Git
- * tooling you may be using.
- *
- * If this script is specified in *groovy.postReceiveScripts* of gitblit.properties
- * or web.xml then it will be executed by any repository when it receives a
- * push. If you choose to share your script then you may have to consider
- * tailoring control-flow based on repository access restrictions.
- *
- * Scripts may also be specified per-repository in the repository settings page.
- * Shared scripts will be excluded from this list of available scripts.
- *
- * This script is dynamically reloaded and it is executed within it's own
- * exception handler so it will not crash another script nor crash Gitblit.
- *
- * If you want this hook script to fail and abort all subsequent scripts in the
- * chain, "return false" at the appropriate failure points.
- *
- * Bound Variables:
- * gitblit Gitblit Server com.gitblit.GitBlit
- * repository Gitblit Repository com.gitblit.models.RepositoryModel
- * receivePack JGit Receive Pack org.eclipse.jgit.transport.ReceivePack
- * user Gitblit User com.gitblit.models.UserModel
- * commands JGit commands Collection
- * url Base url for Gitblit String
- * logger Logs messages to Gitblit org.slf4j.Logger
- * clientLogger Logs messages to Git client com.gitblit.utils.ClientLogger
- *
- * Accessing Gitblit Custom Fields:
- * def myCustomField = repository.customFields.myCustomField
- *
- */
-
-// Indicate we have started the script
-logger.info("sendmail hook triggered by ${user.username} for ${repository.name}")
-
-/*
- * Primitive email notification.
- * This requires the mail settings to be properly configured in Gitblit.
- */
-
-Repository r = gitblit.getRepository(repository.name)
-
-// reuse existing repository config settings, if available
-Config config = r.getConfig()
-def mailinglist = config.getString('hooks', null, 'mailinglist')
-def emailprefix = config.getString('hooks', null, 'emailprefix')
-
-// set default values
-def toAddresses = []
-if (emailprefix == null)
-emailprefix = '[Gitblit]'
-
-if (mailinglist != null) {
- def addrs = mailinglist.split(/(,|\s)/)
- toAddresses.addAll(addrs)
-}
-
-// add all mailing lists defined in gitblit.properties or web.xml
-toAddresses.addAll(gitblit.getStrings(Keys.mail.mailingLists))
-
-// add all team mailing lists
-def teams = gitblit.getRepositoryTeams(repository)
-for (team in teams) {
- TeamModel model = gitblit.getTeamModel(team)
- if (model.mailingLists) {
- toAddresses.addAll(model.mailingLists)
- }
-}
-
-// add all mailing lists for the repository
-toAddresses.addAll(repository.mailingLists)
-
-// define the summary and commit urls
-def repo = repository.name
-def summaryUrl
-def commitUrl
-if (gitblit.getBoolean(Keys.web.mountParameters, true)) {
- repo = repo.replace('/', gitblit.getString(Keys.web.forwardSlashCharacter, '/')).replace('/', '%2F')
- summaryUrl = url + "/summary/$repo"
- commitUrl = url + "/commit/$repo/"
-} else {
- summaryUrl = url + "/summary?r=$repo"
- commitUrl = url + "/commit?r=$repo&h="
-}
-
-// construct a simple text summary of the changes contained in the push
-def branchBreak = '>---------------------------------------------------------------\n'
-def commitBreak = '\n\n ----\n'
-def commitCount = 0
-def changes = ''
-SimpleDateFormat df = new SimpleDateFormat(gitblit.getString(Keys.web.datetimestampLongFormat, 'EEEE, MMMM d, yyyy h:mm a z'))
-def table = { "\n ${JGitUtils.getDisplayName(it.authorIdent)}\n ${df.format(JGitUtils.getCommitDate(it))}\n\n $it.shortMessage\n\n $commitUrl$it.id.name" }
-for (command in commands) {
- def ref = command.refName
- def refType = 'branch'
- if (ref.startsWith('refs/heads/')) {
- ref = command.refName.substring('refs/heads/'.length())
- } else if (ref.startsWith('refs/tags/')) {
- ref = command.refName.substring('refs/tags/'.length())
- refType = 'tag'
- }
-
- switch (command.type) {
- case ReceiveCommand.Type.CREATE:
- def commits = JGitUtils.getRevLog(r, command.oldId.name, command.newId.name).reverse()
- commitCount += commits.size()
- // new branch
- changes += "\n$branchBreak new $refType $ref created ($commits.size commits)\n$branchBreak"
- changes += commits.collect(table).join(commitBreak)
- changes += '\n'
- break
- case ReceiveCommand.Type.UPDATE:
- def commits = JGitUtils.getRevLog(r, command.oldId.name, command.newId.name).reverse()
- commitCount += commits.size()
- // fast-forward branch commits table
- changes += "\n$branchBreak $ref $refType updated ($commits.size commits)\n$branchBreak"
- changes += commits.collect(table).join(commitBreak)
- changes += '\n'
- break
- case ReceiveCommand.Type.UPDATE_NONFASTFORWARD:
- def commits = JGitUtils.getRevLog(r, command.oldId.name, command.newId.name).reverse()
- commitCount += commits.size()
- // non-fast-forward branch commits table
- changes += "\n$branchBreak $ref $refType updated [NON fast-forward] ($commits.size commits)\n$branchBreak"
- changes += commits.collect(table).join(commitBreak)
- changes += '\n'
- break
- case ReceiveCommand.Type.DELETE:
- // deleted branch/tag
- changes += "\n$branchBreak $ref $refType deleted\n$branchBreak"
- break
- default:
- break
- }
-}
-// close the repository reference
-r.close()
-
-// tell Gitblit to send the message (Gitblit filters duplicate addresses)
-gitblit.sendMail("$emailprefix $user.username pushed $commitCount commits => $repository.name", "$summaryUrl\n$changes", toAddresses)
\ No newline at end of file
diff --git a/src/main/distrib/data/groovy/subgit.groovy b/src/main/distrib/data/groovy/subgit.groovy
deleted file mode 100644
index 0c24f4dcc..000000000
--- a/src/main/distrib/data/groovy/subgit.groovy
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2014 TMate Software
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import com.gitblit.GitBlit
-import com.gitblit.models.RepositoryModel
-import com.gitblit.models.UserModel
-
-import org.eclipse.jgit.storage.file.FileBasedConfig
-import org.eclipse.jgit.transport.ReceiveCommand
-import org.eclipse.jgit.transport.ReceiveCommand.Result
-import org.eclipse.jgit.util.FS
-import org.slf4j.Logger
-
-/**
- * Sample Gitblit Pre-Receive Hook: subgit
- * http://subgit.com
- *
- * The Pre-Receive hook is executed after an incoming push has been parsed,
- * validated, and objects have been written but BEFORE the refs are updated.
- * This is the appropriate point to block a push for some reason.
- *
- * This script is only executed when pushing to *Gitblit*, not to other Git
- * tooling you may be using.
- *
- * If this script is specified in *groovy.preReceiveScripts* of gitblit.properties
- * or web.xml then it will be executed by any repository when it receives a
- * push. If you choose to share your script then you may have to consider
- * tailoring control-flow based on repository access restrictions.
- *
- * Scripts may also be specified per-repository in the repository settings page.
- * Shared scripts will be excluded from this list of available scripts.
- *
- * This script is dynamically reloaded and it is executed within it's own
- * exception handler so it will not crash another script nor crash Gitblit.
- *
- * This script may reject one or more commands, but will never return false.
- * Subsequent scripts, if any, will always be invoked.
- *
- * Bound Variables:
- * gitblit Gitblit Server com.gitblit.GitBlit
- * repository Gitblit Repository com.gitblit.models.RepositoryModel
- * receivePack JGit Receive Pack org.eclipse.jgit.transport.ReceivePack
- * user Gitblit User com.gitblit.models.UserModel
- * commands JGit commands Collection
- * url Base url for Gitblit String
- * logger Logs messages to Gitblit org.slf4j.Logger
- * clientLogger Logs messages to Git client com.gitblit.utils.ClientLogger
- *
- * Accessing Gitblit Custom Fields:
- * def myCustomField = repository.customFields.myCustomField
- *
- *
- * Usage:
- *
- * 1. Create Git repository in GitBlit;
- * 2. Register subgit pre-receive groovy hook in repository settings;
- * 3. Install SubGit into created repository:
- * subgit configure --svn-url /data/git/
- * subgit install /data/git/
- *
- * You can enable SubGit pre-receive groovy hook for all repositories: this shouldn't
- * cause any problems as the hook skips those repositories with no SubGit installed.
- *
- */
-
-def JAVA_OPTIONS = ['-noverify', '-Djava.awt.headless=true']
-def MAIN_CLASS = 'org.tmatesoft.translator.SubGitHook'
-
-def repositoryRoot = gitblit.getRepository(repository.name).directory
-def classpath = getClasspath(repositoryRoot)
-if (classpath != null) {
- def input = commands.collect {command -> "${command.oldId.name()} ${command.newId.name()} ${command.refName}\n"}.join()
- def commandLine = [javaExecutable] + JAVA_OPTIONS + ['-cp', classpath, MAIN_CLASS, 'pre-receive', repositoryRoot.absolutePath]
- logger.info("Running SubGit pre-receive hook:\n${commandLine}\n${input}")
- def process = new ProcessBuilder(commandLine).directory(repositoryRoot).start()
- writeInput(process, input)
- readOutput(process)
- if (process.exitValue() != 0) {
- commands.each {command -> command.setResult(Result.REJECTED_OTHER_REASON, 'SubGit: failed to synchronize changes with SVN server')}
- }
-}
-
-def getClasspath(repositoryRoot) {
- def configFile = new File(repositoryRoot, 'subgit/.run/config')
- def config = new FileBasedConfig(configFile, FS.DETECTED)
- config.load()
- def daemonClasspath = config.getString('daemon', null, 'classpath')
- if (daemonClasspath == null) {
- return null
- }
- def binariesDirectory = new File(daemonClasspath)
- if (!binariesDirectory.absolute) {
- binariesDirectory = new File(repositoryRoot, daemonClasspath)
- }
- binariesDirectory.listFiles({dir, name -> name ==~ /.*.jar/ } as FilenameFilter).join(File.pathSeparator)
-}
-
-def getJavaExecutable() {
- def javaHome = System.properties['java.home']
- def isWindows = System.properties['os.name'].toLowerCase().contains('windows')
- def executableName = isWindows ? 'java.exe' : 'java'
- "${javaHome}/bin/${executableName}".toString()
-}
-
-def writeInput(process, input) {
- Thread.start {
- process.out << input
- process.out.close()
- }
-}
-
-def readOutput(process) {
- try {
- def outReader = Thread.start {
- process.inputStream.eachLine {line -> clientLogger.info(line)}
- }
- def errReader = Thread.start {
- process.errorStream.eachLine {line -> clientLogger.info(line)}
- }
- process.waitFor()
- outReader.join()
- errReader.join()
- } finally {
- process.destroy()
- }
-}
\ No newline at end of file
diff --git a/src/main/distrib/data/groovy/thebuggenie.groovy b/src/main/distrib/data/groovy/thebuggenie.groovy
deleted file mode 100644
index b4385a26a..000000000
--- a/src/main/distrib/data/groovy/thebuggenie.groovy
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2011 Wolfgang Gassler gassler.org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import com.gitblit.GitBlit
-import com.gitblit.Keys
-import com.gitblit.models.RepositoryModel
-import com.gitblit.models.TeamModel
-import com.gitblit.models.UserModel
-import com.gitblit.utils.JGitUtils
-import java.text.SimpleDateFormat
-import org.eclipse.jgit.lib.Repository
-import org.eclipse.jgit.lib.Config
-import org.eclipse.jgit.revwalk.RevCommit
-import org.eclipse.jgit.transport.ReceiveCommand
-import org.eclipse.jgit.transport.ReceiveCommand.Result
-import org.slf4j.Logger
-import org.eclipse.jgit.lib.IndexDiff
-import org.eclipse.jgit.lib.Constants
-import com.gitblit.utils.DiffUtils
-
-/**
- * Gitblit Post-Receive Hook: thebuggenie
- * www.thebuggenie.com
- *
- * Submit the commit information to thebuggenie bug tracker by calling thebuggenie client tool
- *
- * Config of the Script:
- *
- * Setup a custom gitblit field in the proprties file of gitblit by adding the following line
- * groovy.customFields = "thebuggenieProjectId=TheBugGennie project id (used for thebuggenie hoocks)"
- * This field allows to specify the project id of thebuggenie project in the edit section of gitblit
- *
- * Furthermore you need to set the path to thebuggenie client tool by adding the following property to
- * the gitblit properties file
- * thebuggenie.tbg_cli = /var/www/thebuggenie_root/tbg_cli
- */
-
-// Indicate we have started the script
-logger.info("thebuggenie hook triggered by ${user.username} for ${repository.name}")
-
-//fetch the repository data
-Repository r = gitblit.getRepository(repository.name)
-
-//get project id which is defined in the git repo metadata
-def tbgProjectId = repository.customFields.thebuggenieProjectId
-//get path to the thebuggenie client tool which is defined in the gitblit proprties files
-def tbgCliPath = gitblit.getString('thebuggenie.tbg_cli', '/var/www/thebuggenie/tbg_cli')
-def tbgCliDirPath = new File(tbgCliPath).getParent()
-
-for(command in commands) {
- //fetch all pushed commits
- def commits = JGitUtils.getRevLog(r, command.oldId.name, command.newId.name).reverse()
- for (commit in commits) {
- //get hashes and author data of commit
- def oldhash = commit.getParent(0).getId().getName()
- def newhash = commit.getId().getName()
- def authorIdent = commit.getAuthorIdent()
- def author = "${authorIdent.name} <${authorIdent.emailAddress}>"
- //fetch all changed files of the commit
- def files = JGitUtils.getFilesInCommit(r,commit)
- def changedFiles = ""
- for (f in files) {
- //transform file data to the format which is needed by thebuggenie
- changedFiles += f.changeType.toString().substring(0,1)+"\t${f.path}\n"
- }
- //ok let's submit all information to thebuggenie by calling the client tool
-// def shc = "$tbgCliPath vcs_integration:report_commit $tbgProjectId \"$author\" $newhash \"${commit.fullMessage}\" \"$changedFiles\" $oldhash ${commit.commitTime}"
- def shc = [tbgCliPath, "vcs_integration:report_commit", tbgProjectId, author, newhash, commit.getFullMessage(), changedFiles, oldhash, commit.getCommitTime()];
- logger.info("executing in path " + tbgCliDirPath + ": "+shc)
- shc.execute(null, new File(tbgCliDirPath))
- }
-}
-
-// close the repository reference
-r.close()
diff --git a/src/main/distrib/data/groovy/youtrack-readme.md b/src/main/distrib/data/groovy/youtrack-readme.md
deleted file mode 100644
index 81a2c4eac..000000000
--- a/src/main/distrib/data/groovy/youtrack-readme.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# GitBlit YouTrack Receive Hook
-
-GitBlit receive hook for updating referenced YouTrack issues.
-
-This script has only been tested with the cloud hosted YouTrack instance.
-
-## Usage
-
-Due to limited authentication options when using the YouTrack REST API, you have to store a username and password for an account with appropriate permissions for adding comments to any issue. Hopefully in the future YouTrack will support API keys or similar.
-
-1. Update your `gitblit.properties` file with the following entries:
- * `groovy.customFields = "youtrackProjectID=YouTrack Project ID" ` *(or append to existing setting)*
- * `youtrack.host = example.myjetbrains.com`
- * `youtrack.user = ytUser`
- * `youtrack.pass = insecurep@sswordsRus`
-
- (But using your own host and credential info).
-
-2. Copy the `youtrack.groovy` script to the `/groovy` scripts directory.
-3. In GitBlit, go to a repository, click the *edit* button, then click the *receive* link. In the *post0receive scripts* section you should see `youtrack` as an option. Move it over to the *Selected* column.
-4. At the bottom of this same screen should should be a *custom fields* section with a **YouTrack Project ID** field. Enter the YouTrack Project ID associated with the repository.
-5. When you commit changes, reference YouTrack issues with `#{projectID}-{issueID}` where `{projectID}` is the YouTrack Project ID, and `{issueID}` is the issue number. For example, to references issue `34` in project `fizz`:
-
- git commit -m'Changed bazinator to fix issue #fizz-34.'
-
- Multiple issues may be referenced in the same commit message.
-
-## Attribution
-
-Much of this script was cobbled together from the example receive hooks in the official [GitBlit](https://github.com/gitblit-org/gitblit) distribution.
diff --git a/src/main/distrib/data/groovy/youtrack.groovy b/src/main/distrib/data/groovy/youtrack.groovy
deleted file mode 100644
index c94d8fd18..000000000
--- a/src/main/distrib/data/groovy/youtrack.groovy
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright 2013 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import com.gitblit.GitBlit
-import com.gitblit.Keys
-import com.gitblit.models.RepositoryModel
-import com.gitblit.models.TeamModel
-import com.gitblit.models.UserModel
-import com.gitblit.utils.JGitUtils
-import java.text.SimpleDateFormat
-import org.eclipse.jgit.lib.Repository
-import org.eclipse.jgit.lib.Config
-import org.eclipse.jgit.transport.ReceiveCommand
-import org.eclipse.jgit.transport.ReceiveCommand.Result
-import org.slf4j.Logger
-
-import org.eclipse.jgit.api.Status;
-import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.diff.DiffEntry;
-import org.eclipse.jgit.diff.DiffFormatter;
-import org.eclipse.jgit.diff.RawTextComparator;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.IndexDiff;
-import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.patch.FileHeader;
-import org.eclipse.jgit.revwalk.RevWalk;
-import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.jgit.treewalk.FileTreeIterator;
-import org.eclipse.jgit.treewalk.EmptyTreeIterator;
-import org.eclipse.jgit.treewalk.CanonicalTreeParser;
-import org.eclipse.jgit.util.io.DisabledOutputStream;
-
-import java.util.Set;
-import java.util.HashSet;
-
-import org.apache.http.HttpHost;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.client.AuthCache;
-import org.apache.http.client.CredentialsProvider;
-import org.apache.http.protocol.*;
-import org.apache.http.client.protocol.*;
-import org.apache.http.client.methods.*;
-import org.apache.http.impl.client.*;
-import org.apache.http.impl.auth.BasicScheme;
-import org.apache.http.util.EntityUtils;
-
-
-/**
- * GitBlit Post-Receive Hook for YouTrack
- *
- * The purpose of this script is to invoke the YouTrack API and update a case when
- * push is received based.
- *
- * The Post-Receive hook is executed AFTER the pushed commits have been applied
- * to the Git repository. This is the appropriate point to trigger an
- * integration build or to send a notification.
- *
- * If you want this hook script to fail and abort all subsequent scripts in the
- * chain, "return false" at the appropriate failure points.
- *
- * Bound Variables:
- * gitblit Gitblit Server com.gitblit.GitBlit
- * repository Gitblit Repository com.gitblit.models.RepositoryModel
- * receivePack JGit Receive Pack org.eclipse.jgit.transport.ReceivePack
- * user Gitblit User com.gitblit.models.UserModel
- * commands JGit commands Collection
- * url Base url for Gitblit String
- * logger Logs messages to Gitblit org.slf4j.Logger
- * clientLogger Logs messages to Git client com.gitblit.utils.ClientLogger
- *
- *
- * Custom Fileds Used by This script
- * youtrackProjectID - Project ID in YouTrack
- *
- * Make sure to add the following to your gitblit.properties file:
- * groovy.customFields = "youtrackProjectID=YouTrack Project ID"
- * youtrack.host = example.myjetbrains.com
- * youtrack.user = ytUser
- * youtrack.pass = insecurep@sswordsRus
- */
-
-// Indicate we have started the script
-logger.info("youtrack hook triggered in ${url} by ${user.username} for ${repository.name}")
-
-Repository r = gitblit.getRepository(repository.name)
-
-// pull custom fields from repository specific values
-def youtrackProjectID = repository.customFields.youtrackProjectID
-
-if(youtrackProjectID == null || youtrackProjectID.length() == 0) return true;
-
-def youtrackHost = gitblit.getString('youtrack.host', 'nohost')
-def bugIdRegex = gitblit.getString('youtrack.commitMessageRegex', "#${youtrackProjectID}-([0-9]+)")
-def youtrackUser = gitblit.getString('youtrack.user', 'nouser')
-def youtrackPass = gitblit.getString('youtrack.pass', 'nopassword')
-
-HttpHost target = new HttpHost(youtrackHost, 80, "http");
-CredentialsProvider credsProvider = new BasicCredentialsProvider();
-credsProvider.setCredentials(
- new AuthScope(target.getHostName(), target.getPort()),
- new UsernamePasswordCredentials(youtrackUser, youtrackPass));
-def httpclient = new DefaultHttpClient();
-
-httpclient.setCredentialsProvider(credsProvider);
-
-try {
-
- AuthCache authCache = new BasicAuthCache();
- BasicScheme basicAuth = new BasicScheme();
- authCache.put(target, basicAuth);
- BasicHttpContext localcontext = new BasicHttpContext();
- localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache);
-
-
- for (command in commands) {
- for( commit in JGitUtils.getRevLog(r, command.oldId.name, command.newId.name).reverse() ) {
- def bugIds = new java.util.HashSet()
- def longMsg = commit.getFullMessage()
- // Grab the second match group and then filter out each numeric ID and add it to array
- (longMsg =~ bugIdRegex).each{ (it[1] =~ "\\d+").each { bugIds.add(it)} }
-
- if(bugIds.size() > 0) {
- def comment = createIssueComment(command, commit)
-
- logger.debug("Submitting youtrack comment:\n" + comment)
-
- def encoded = URLEncoder.encode(comment)
- for(bugId in bugIds ) {
- def baseURL = "http://${youtrackHost}/youtrack/rest/issue/${youtrackProjectID}-${bugId}/execute?command=&comment=" + encoded
- def post = new HttpPost(baseURL);
-
- clientLogger.info("Executing request " + post.getRequestLine() + " to target " + target);
- def response = httpclient.execute(target, post, localcontext);
- logger.debug(response.getStatusLine().toString());
- EntityUtils.consume(response.getEntity());
- }
- }
- }
- }
-}
-finally {
- r.close()
-}
-
-def createIssueComment(command, commit) {
- def commits = [commit] // Borrowed code expects a collection.
- Repository r = gitblit.getRepository(repository.name)
- // define the summary and commit urls
- def repo = repository.name
- def summaryUrl
- def commitUrl
- if (gitblit.getBoolean(Keys.web.mountParameters, true)) {
- repo = repo.replace('/', gitblit.getString(Keys.web.forwardSlashCharacter, '/')).replace('/', '%2F')
- summaryUrl = url + "/summary/$repo"
- commitUrl = url + "/commit/$repo/"
- } else {
- summaryUrl = url + "/summary?r=$repo"
- commitUrl = url + "/commit?r=$repo&h="
- }
-
- // construct a simple text summary of the changes contained in the push
- def commitBreak = '\n'
- def commitCount = 0
- def changes = ''
-
- SimpleDateFormat df = new SimpleDateFormat(gitblit.getString(Keys.web.datetimestampLongFormat, 'EEEE, MMMM d, yyyy h:mm a z'))
-
- def table = {
- def shortSha = it.id.name.substring(0, 8)
- "* [$commitUrl$it.id.name ${shortSha}] by *${it.authorIdent.name}* on ${df.format(JGitUtils.getCommitDate(it))}\n" +
- " {cut $it.shortMessage}\n{noformat}$it.fullMessage{noformat}{cut}"
- }
-
- def ref = command.refName
- def refType = 'branch'
- if (ref.startsWith('refs/heads/')) {
- ref = command.refName.substring('refs/heads/'.length())
- } else if (ref.startsWith('refs/tags/')) {
- ref = command.refName.substring('refs/tags/'.length())
- refType = 'tag'
- }
-
- switch (command.type) {
- case ReceiveCommand.Type.CREATE:
- // new branch
- changes += "''new $refType $ref created''\n"
- changes += commits.collect(table).join(commitBreak)
- changes += '\n'
- break
- case ReceiveCommand.Type.UPDATE:
- // fast-forward branch commits table
- changes += "''$ref $refType updated''\n"
- changes += commits.collect(table).join(commitBreak)
- changes += '\n'
- break
- case ReceiveCommand.Type.UPDATE_NONFASTFORWARD:
- // non-fast-forward branch commits table
- changes += "''$ref $refType updated [NON fast-forward]''"
- changes += commits.collect(table).join(commitBreak)
- changes += '\n'
- break
- case ReceiveCommand.Type.DELETE:
- // deleted branch/tag
- changes += "''$ref $refType deleted''"
- break
- default:
- break
- }
-
- return "$user.username pushed commits to [$summaryUrl $repository.name]\n$changes"
-}
diff --git a/src/main/distrib/data/projects.conf b/src/main/distrib/data/projects.conf
deleted file mode 100644
index d43f48295..000000000
--- a/src/main/distrib/data/projects.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-[project "main"]
- title = Main Repositories
- description = main group of repositories
\ No newline at end of file
diff --git a/src/main/distrib/data/projects_ja.conf b/src/main/distrib/data/projects_ja.conf
deleted file mode 100644
index b9b8b1978..000000000
--- a/src/main/distrib/data/projects_ja.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-#ã“ã®ãƒ•ァイルã¯ã€ä»–ã®ç¿»è¨³ãƒ•ァイルã¨é•ã„ã“ã®ãƒ•ァイルåã®ã¾ã¾ã§ã¯å‹•作ã—ãªã„。
-#_ja ã¯ä¾¿å®œä¸Šä»˜ã‘ã¦ã„ã‚‹åå‰ã§ã€projects.conf ã«æ”¹åã—ã€æ—¢å˜ã® projects.conf ã¨ç½®ãæ›ãˆã¦åˆã‚ã¦å‹•作ã™ã‚‹ã€‚
-[project "main"]
- title = メインリãƒã‚¸ãƒˆãƒª
- description = 共有リãƒã‚¸ãƒˆãƒªç¾¤
diff --git a/src/main/distrib/data/users.conf b/src/main/distrib/data/users.conf
deleted file mode 100644
index e9dbd83d5..000000000
--- a/src/main/distrib/data/users.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-[user "admin"]
- password = admin
- role = "#admin"
- role = "#notfederated"
diff --git a/src/main/distrib/federation.properties b/src/main/distrib/federation.properties
deleted file mode 100644
index 72058f066..000000000
--- a/src/main/distrib/federation.properties
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# Git Repository Settings
-#
-
-# Base folder for repositories
-# Use forward slashes even on Windows!!
-# e.g. c:/gitrepos
-#
-# SINCE 0.5.0
-# RESTART REQUIRED
-git.repositoriesFolder = ${baseFolder}/git
-
-# Search the repositories folder subfolders for other repositories.
-# Repositories MAY NOT be nested (i.e. one repository within another)
-# but they may be grouped together in subfolders.
-# e.g. c:/gitrepos/libraries/mylibrary.git
-# c:/gitrepos/libraries/myotherlibrary.git
-#
-# SINCE 0.5.0
-git.searchRepositoriesSubfolders = true
-
-# Your federation name is used for federation status acknowledgments. If it is
-# unset, and you elect to send a status acknowledgment, your Gitblit instance
-# will be identified by its hostname, if available, else your internal ip address.
-# The source Gitblit instance will also append your external IP address to your
-# identification to differentiate multiple pulling systems behind a single proxy.
-#
-# SINCE 0.6.0
-federation.name =
-
-# Federation pull registrations
-# Registrations are read once, at startup.
-#
-# RESTART REQUIRED
-#
-# frequency:
-# The shortest frequency allowed is every 5 minutes
-# Decimal frequency values are cast to integers
-# Frequency values may be specified in mins, hours, or days
-# Values that can not be parsed or are unspecified default to *federation.defaultFrequency*
-#
-# folder:
-# if unspecified, the folder is *git.repositoriesFolder*
-# if specified, the folder is relative to *git.repositoriesFolder*
-#
-# bare:
-# if true, each repository will be created as a *bare* repository and will not
-# have a working directory.
-#
-# if false, each repository will be created as a normal repository suitable
-# for local work.
-#
-# mirror:
-# if true, each repository HEAD is reset to *origin/master* after each pull.
-# The repository will be flagged *isFrozen* after the initial clone.
-#
-# if false, each repository HEAD will point to the FETCH_HEAD of the initial
-# clone from the origin until pushed to or otherwise manipulated.
-#
-# mergeAccounts:
-# if true, remote accounts and their permissions are merged into your
-# users.properties file
-#
-# notifyOnError:
-# if true and the mail configuration is properly set, administrators will be
-# notified by email of pull failures
-#
-# include and exclude:
-# Space-delimited list of repositories to include or exclude from pull
-# may be * wildcard to include or exclude all
-# may use fuzzy match (e.g. org.eclipse.*)
-
-#
-# (Nearly) Perfect Mirror example
-#
-
-#federation.example1.url = https://go.gitblit.com
-#federation.example1.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4
-#federation.example1.frequency = 120 mins
-#federation.example1.folder =
-#federation.example1.bare = true
-#federation.example1.mirror = true
-#federation.example1.mergeAccounts = true
diff --git a/src/main/distrib/linux/add-indexed-branch.sh b/src/main/distrib/linux/add-indexed-branch.sh
deleted file mode 100644
index 0285d1bb2..000000000
--- a/src/main/distrib/linux/add-indexed-branch.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------------------
-# This is for Lucene search integration.
-#
-# Allows you to add an indexed branch specification to the repository config
-# for all matching repositories in the specified folder.
-#
-# All repositories are included unless excluded using a --skip parameter.
-# --skip supports simple wildcard fuzzy matching however only 1 asterisk is
-# allowed per parameter.
-#
-# Always use forward-slashes for the path separator in your parameters!!
-#
-# Set FOLDER to the server's git.repositoriesFolder
-# Set BRANCH ("default" or fully qualified ref - i.e. refs/heads/master)
-# Set EXCLUSIONS for any repositories that you do not want to change
-# --------------------------------------------------------------------------
-FOLDER=data/git
-EXCLUSIONS="--skip test.git --skip group/test*"
-BRANCH=default
-java -cp gitblit.jar:"ext/*" com.gitblit.AddIndexedBranch --repositoriesFolder "$FOLDER" --branch "$BRANCH" "$EXCLUSIONS"
diff --git a/src/main/distrib/linux/authority.sh b/src/main/distrib/linux/authority.sh
deleted file mode 100644
index c5c6c6875..000000000
--- a/src/main/distrib/linux/authority.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-java -cp "gitblit.jar:ext/*" com.gitblit.authority.GitblitAuthority --baseFolder data
diff --git a/src/main/distrib/linux/gitblit-stop.sh b/src/main/distrib/linux/gitblit-stop.sh
deleted file mode 100644
index 2a7746445..000000000
--- a/src/main/distrib/linux/gitblit-stop.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-java -cp "gitblit.jar:ext/*" com.gitblit.GitBlitServer --baseFolder data --stop
diff --git a/src/main/distrib/linux/gitblit.sh b/src/main/distrib/linux/gitblit.sh
deleted file mode 100644
index 2a52e24ed..000000000
--- a/src/main/distrib/linux/gitblit.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-java -cp "gitblit.jar:ext/*" com.gitblit.GitBlitServer --baseFolder data
diff --git a/src/main/distrib/linux/install-service-centos.sh b/src/main/distrib/linux/install-service-centos.sh
deleted file mode 100644
index 19d28c736..000000000
--- a/src/main/distrib/linux/install-service-centos.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-sudo cp service-centos.sh /etc/init.d/gitblit
-sudo chkconfig --add gitblit
diff --git a/src/main/distrib/linux/install-service-fedora.sh b/src/main/distrib/linux/install-service-fedora.sh
deleted file mode 100755
index df17590f0..000000000
--- a/src/main/distrib/linux/install-service-fedora.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash -x
-# This script installs Gitblit on a system running under systemd.
-# The script assumes the server is running as user giblit
-
-# First create a file with the default settings
-cat > /tmp/gitblit.defaults << EOF
-GITBLIT_PATH=/opt/gitblit
-GITBLIT_BASE_FOLDER=/opt/gitblit/data
-GITBLIT_HTTP_PORT=0
-GITBLIT_HTTPS_PORT=8443
-EOF
-# Create a systemd service file
-cat > /tmp/gitblit.service << EOF
-[Unit]
-Description=Gitblit managing, viewing, and serving Git repositories.
-After=network.target
-
-[Service]
-User=gitblit
-Group=gitblit
-Environment="ARGS=-server -Xmx1024M -Djava.awt.headless=true -cp"
-EnvironmentFile=-/etc/sysconfig/gitblit
-WorkingDirectory=/opt/gitblit
-ExecStart=/usr/bin/java \$ARGS gitblit.jar:ext/* com.gitblit.GitBlitServer --httpsPort \$GITBLIT_HTTPS_PORT --httpPort \$GITBLIT_HTTP_PORT --baseFolder \$GITBLIT_BASE_FOLDER --dailyLogFile
-ExecStop=/usr/bin/java \$ARGS gitblit.jar:ext/* com.gitblit.GitBlitServer --baseFolder \$GITBLIT_BASE_FOLDER --stop
-
-[Install]
-WantedBy=multi-user.target
-EOF
-
-# Finally copy the files to the destination and register the systemd unit.
-sudo sh -c "cp /tmp/gitblit.defaults /etc/sysconfig/gitblit && cp /tmp/gitblit.service /etc/systemd/system/"
-sudo sh -c "systemctl daemon-reload && systemctl enable gitblit.service && systemctl start gitblit.service"
diff --git a/src/main/distrib/linux/install-service-freebsd.sh b/src/main/distrib/linux/install-service-freebsd.sh
deleted file mode 100644
index 727779cf0..000000000
--- a/src/main/distrib/linux/install-service-freebsd.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-sudo cp service-freebsd.sh /usr/local/etc/rc.d/gitblit
diff --git a/src/main/distrib/linux/install-service-ubuntu.sh b/src/main/distrib/linux/install-service-ubuntu.sh
deleted file mode 100644
index 72c4e6c24..000000000
--- a/src/main/distrib/linux/install-service-ubuntu.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-sudo cp service-ubuntu.sh /etc/init.d/gitblit
-sudo update-rc.d gitblit defaults
diff --git a/src/main/distrib/linux/java-proxy-config.sh b/src/main/distrib/linux/java-proxy-config.sh
deleted file mode 100644
index 5f7a2a270..000000000
--- a/src/main/distrib/linux/java-proxy-config.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-
-# To set the proxy configuration, specify the following host name and port
-#PROXY_HOST=
-#PROXY_PORT=
-
-# To exclude any hosts from proxy configuration such that they directly accessed by Gitblit without passing through the proxy server, append the host name to the following variable using "|" as the separator
-NON_PROXY_HOSTS="localhost|127.0.0.*|*.local|192.168.*.*|10.193.*.*"
-
-### The following should not need to be modified
-
-JAVA_PROXY_CONFIG=""
-
-if [ -n "${PROXY_HOST}" -a -n "${PROXY_PORT}" ]; then
-
- JAVA_PROXY_CONFIG=" -DproxySet=true -Dhttp.proxyHost=${PROXY_HOST} -Dhttp.proxyPort=${PROXY_PORT} -Dhttps.proxyHost=${PROXY_HOST} -Dhttps.proxyPort=${PROXY_PORT} -Dftp.proxyHost=${PROXY_HOST} -Dftp.proxyPort=${PROXY_PORT} "
-fi
-
-if [ -n "${PROXY_HOST}" -a -n "${PROXY_PORT}" -a -n "${NON_PROXY_HOSTS}" ]; then
-
- JAVA_PROXY_CONFIG="${JAVA_PROXY_CONFIG} -Dhttp.nonProxyHosts=\"${NON_PROXY_HOSTS}\" -Dftp.nonProxyHosts=\"${NON_PROXY_HOSTS}\" "
-fi
-
-export JAVA_PROXY_CONFIG
-
diff --git a/src/main/distrib/linux/migrate-tickets.sh b/src/main/distrib/linux/migrate-tickets.sh
deleted file mode 100644
index 0e2829a89..000000000
--- a/src/main/distrib/linux/migrate-tickets.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------------------
-# This is for migrating Tickets from one service to another.
-#
-# usage:
-#
-# migrate-tickets.sh
-#
-# --------------------------------------------------------------------------
-
-if [ -z $1 ] || [ -z $2 ]; then
- echo "Please specify the output ticket service and your baseFolder!";
- echo "";
- echo "usage:";
- echo " migrate-tickets ";
- echo "";
- exit 1;
-fi
-
-java -cp "gitblit.jar:ext/*" com.gitblit.MigrateTickets "$1" --baseFolder "$2"
-
diff --git a/src/main/distrib/linux/reindex-tickets.sh b/src/main/distrib/linux/reindex-tickets.sh
deleted file mode 100644
index ba808fa68..000000000
--- a/src/main/distrib/linux/reindex-tickets.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-# --------------------------------------------------------------------------
-# This is for reindexing Tickets with Lucene.
-#
-# Since the Tickets feature is undergoing massive churn it may be necessary
-# to reindex tickets due to model or index changes.
-#
-# usage:
-#
-# reindex-tickets.sh
-#
-# --------------------------------------------------------------------------
-
-if [ -z $1 ] ; then
- echo "Please specify your baseFolder!";
- echo "";
- echo "usage:";
- echo " reindex-tickets ";
- echo "";
- exit 1;
-fi
-
-java -cp "gitblit.jar:ext/*" com.gitblit.ReindexTickets --baseFolder "$1"
-
diff --git a/src/main/distrib/linux/service-centos.sh b/src/main/distrib/linux/service-centos.sh
deleted file mode 100644
index a2645e7ec..000000000
--- a/src/main/distrib/linux/service-centos.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash
-# chkconfig: 3 21 91
-# description: Starts and Stops gitblit
-# Source function library.
-. /etc/init.d/functions
-
-# change theses values (default values)
-GITBLIT_PATH=/opt/gitblit
-GITBLIT_BASE_FOLDER=/opt/gitblit/data
-GITBLIT_HTTP_PORT=0
-GITBLIT_HTTPS_PORT=8443
-GITBLIT_LOG=/var/log/gitblit.log
-source ${GITBLIT_PATH}/java-proxy-config.sh
-JAVA="java -server -Xmx1024M ${JAVA_PROXY_CONFIG} -Djava.awt.headless=true -cp"
-
-RETVAL=0
-
-case "$1" in
- start)
- if [ -f $GITBLIT_PATH/gitblit.jar ];
- then
- echo $"Starting gitblit server"
- cd $GITBLIT_PATH
- $JAVA "$GITBLIT_PATH/gitblit.jar:$GITBLIT_PATH/ext/*" com.gitblit.GitBlitServer --httpsPort $GITBLIT_HTTPS_PORT --httpPort $GITBLIT_HTTP_PORT --baseFolder $GITBLIT_BASE_FOLDER --dailyLogFile &
- echo "."
- exit $RETVAL
- fi
- ;;
-
- stop)
- if [ -f $GITBLIT_PATH/gitblit.jar ];
- then
- echo $"Stopping gitblit server"
- cd $GITBLIT_PATH
- $JAVA "$GITBLIT_PATH/gitblit.jar:$GITBLIT_PATH/ext/*" com.gitblit.GitBlitServer --baseFolder $GITBLIT_BASE_FOLDER --stop > /dev/null &
- echo "."
- exit $RETVAL
- fi
- ;;
-
- force-reload|restart)
- $0 stop
- sleep 5
- $0 start
- ;;
-
- *)
- echo $"Usage: /etc/init.d/gitblit {start|stop|restart|force-reload}"
- exit 1
- ;;
-esac
-
-exit $RETVAL
diff --git a/src/main/distrib/linux/service-freebsd.sh b/src/main/distrib/linux/service-freebsd.sh
deleted file mode 100644
index 513e64c44..000000000
--- a/src/main/distrib/linux/service-freebsd.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/sh
-
-# PROVIDE: gitblit
-# BEFORE: LOGIN
-# KEYWORD: shutdown
-
-PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
-
-. /etc/rc.subr
-
-name="gitblit"
-rcvar="gitblit_enable"
-
-pidfile="/var/run/${name}.pid"
-
-start_cmd="${name}_start"
-stop_cmd="${name}_stop"
-restart_cmd="${name}_restart"
-
-
-# change theses values (default values)
-GITBLIT_PATH=/opt/gitblit
-GITBLIT_BASE_FOLDER=/opt/gitblit/data
-. ${GITBLIT_PATH}/java-proxy-config.sh
-COMMAND_LINE="java -server -Xmx1024M ${JAVA_PROXY_CONFIG} -Djava.awt.headless=true -cp gitblit.jar:ext/* com.gitblit.GitBlitServer --baseFolder $GITBLIT_BASE_FOLDER"
-
-gitblit_start()
-{
- echo "Starting Gitblit Server..."
- cd $GITBLIT_PATH
- $COMMAND_LINE --dailyLogFile &
-}
-
-gitblit_stop()
-{
- echo "Stopping Gitblit Server..."
- cd $GITBLIT_PATH
- $COMMAND_LINE --stop > /dev/null &
-}
-
-gitblit_restart()
-{
- $0 stop
- sleep 5
- $0 start
-}
-
-load_rc_config $name
-run_rc_command "$1"
diff --git a/src/main/distrib/linux/service-ubuntu.sh b/src/main/distrib/linux/service-ubuntu.sh
deleted file mode 100644
index 461a678c6..000000000
--- a/src/main/distrib/linux/service-ubuntu.sh
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/bash
-### BEGIN INIT INFO
-# Provides: gitblit
-# Required-Start: $remote_fs $syslog $network
-# Required-Stop: $remote_fs $syslog $network
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Gitblit repository server
-# Description: Gitblit is a stand-alone service for managing, viewing and serving Git repositories.
-### END INIT INFO
-
-. /lib/init/vars.sh
-. /lib/lsb/init-functions
-
-PATH=/sbin:/bin:/usr/bin:/usr/sbin
-
-# change theses values (default values)
-GITBLIT_PATH=/opt/gitblit
-GITBLIT_BASE_FOLDER=/opt/gitblit/data
-GITBLIT_USER="gitblit"
-source ${GITBLIT_PATH}/java-proxy-config.sh
-ARGS="-server -Xmx1024M ${JAVA_PROXY_CONFIG} -Djava.awt.headless=true -cp gitblit.jar:ext/* com.gitblit.GitBlitServer --baseFolder $GITBLIT_BASE_FOLDER --dailyLogFile"
-
-RETVAL=0
-
-case "$1" in
- start)
- if [ -f $GITBLIT_PATH/gitblit.jar ];
- then
- echo $"Starting gitblit server"
- start-stop-daemon --start --quiet --background --oknodo --make-pidfile --pidfile /var/run/gitblit.pid --exec /usr/bin/java --chuid $GITBLIT_USER --chdir $GITBLIT_PATH -- $ARGS
- exit $RETVAL
- fi
- ;;
-
- stop)
- if [ -f $GITBLIT_PATH/gitblit.jar ];
- then
- echo $"Stopping gitblit server"
- start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/gitblit.pid
- exit $RETVAL
- fi
- ;;
-
- force-reload|restart)
- $0 stop
- sleep 5
- $0 start
- ;;
-
- *)
- echo $"Usage: /etc/init.d/gitblit {start|stop|restart|force-reload}"
- exit 1
- ;;
-esac
-
-exit $RETVAL
diff --git a/src/main/distrib/win/add-indexed-branch.cmd b/src/main/distrib/win/add-indexed-branch.cmd
deleted file mode 100644
index 25b463839..000000000
--- a/src/main/distrib/win/add-indexed-branch.cmd
+++ /dev/null
@@ -1,24 +0,0 @@
-@REM --------------------------------------------------------------------------
-@REM This is for Lucene search integration.
-@REM
-@REM Allows you to add an indexed branch specification to the repository config
-@REM for all matching repositories in the specified folder.
-@REM
-@REM All repositories are included unless excluded using a --skip parameter.
-@REM --skip supports simple wildcard fuzzy matching however only 1 asterisk is
-@REM allowed per parameter.
-@REM
-@REM Always use forward-slashes for the path separator in your parameters!!
-@REM
-@REM Set FOLDER to the server's git.repositoriesFolder
-@REM Set BRANCH ("default" or fully qualified ref - i.e. refs/heads/master)
-@REM Set EXCLUSIONS for any repositories that you do not want to change
-@REM --------------------------------------------------------------------------
-@SETLOCAL
-@SET FOLDER=data/git
-@SET EXCLUSIONS=--skip test.git --skip group/test*
-@SET BRANCH=default
-@PUSHD %~dp0
-@java -cp gitblit.jar;"%CD%\ext\*" com.gitblit.AddIndexedBranch --repositoriesFolder %FOLDER% --branch %BRANCH% %EXCLUSIONS% %*
-@POPD
-@ENDLOCAL
diff --git a/src/main/distrib/win/amd64/gitblit.exe b/src/main/distrib/win/amd64/gitblit.exe
deleted file mode 100644
index b867810dd..000000000
Binary files a/src/main/distrib/win/amd64/gitblit.exe and /dev/null differ
diff --git a/src/main/distrib/win/authority.cmd b/src/main/distrib/win/authority.cmd
deleted file mode 100644
index a313cd73e..000000000
--- a/src/main/distrib/win/authority.cmd
+++ /dev/null
@@ -1,8 +0,0 @@
-@SETLOCAL
-
-@SET gbhome=%~dp0
-@SET gbhome=%gbhome:~0,-1%
-
-@java -cp "%gbhome%\gitblit.jar";"%gbhome%\ext\*" com.gitblit.authority.GitblitAuthority --baseFolder "%gbhome%\data" %*
-
-@ENDLOCAL
diff --git a/src/main/distrib/win/gitblit-stop.cmd b/src/main/distrib/win/gitblit-stop.cmd
deleted file mode 100644
index b2cdbc44b..000000000
--- a/src/main/distrib/win/gitblit-stop.cmd
+++ /dev/null
@@ -1 +0,0 @@
-@java -cp "%~dp0gitblit.jar";"%~dp0ext\*" com.gitblit.GitBlitServer --stop %*
diff --git a/src/main/distrib/win/gitblit.cmd b/src/main/distrib/win/gitblit.cmd
deleted file mode 100644
index c02e3896e..000000000
--- a/src/main/distrib/win/gitblit.cmd
+++ /dev/null
@@ -1,8 +0,0 @@
-@SETLOCAL
-
-@SET gbhome=%~dp0
-@SET gbhome=%gbhome:~0,-1%
-
-@java -cp "%gbhome%\gitblit.jar";"%gbhome%\ext\*" com.gitblit.GitBlitServer --baseFolder "%gbhome%\data" %*
-
-@ENDLOCAL
diff --git a/src/main/distrib/win/gitblitw.exe b/src/main/distrib/win/gitblitw.exe
deleted file mode 100644
index dde1279cf..000000000
Binary files a/src/main/distrib/win/gitblitw.exe and /dev/null differ
diff --git a/src/main/distrib/win/ia64/gitblit.exe b/src/main/distrib/win/ia64/gitblit.exe
deleted file mode 100644
index 784f3c458..000000000
Binary files a/src/main/distrib/win/ia64/gitblit.exe and /dev/null differ
diff --git a/src/main/distrib/win/installService.cmd b/src/main/distrib/win/installService.cmd
deleted file mode 100644
index 23d45a462..000000000
--- a/src/main/distrib/win/installService.cmd
+++ /dev/null
@@ -1,44 +0,0 @@
-@REM Install Gitblit as a Windows service.
-
-@REM gitblitw.exe (prunmgr.exe) is a GUI application for monitoring
-@REM and configuring the Gitblit procrun service.
-@REM
-@REM By default this tool launches the service properties dialog
-@REM but it also has some other very useful functionality.
-@REM
-@REM http://commons.apache.org/daemon/procrun.html
-
-@SETLOCAL
-
-@REM arch = x86, amd64, or ia32
-SET ARCH=amd64
-
-@SET gbhome=%~dp0
-@SET gbhome=%gbhome:~0,-1%
-
-@REM Be careful not to introduce trailing whitespace after the ^ characters.
-@REM Use ; or # to separate values in the --StartParams parameter.
-"%gbhome%\%ARCH%\gitblit.exe" //IS//gitblit ^
- --DisplayName="gitblit" ^
- --Description="a pure Java Git solution" ^
- --Startup=auto ^
- --LogPath="%gbhome%\logs" ^
- --LogLevel=INFO ^
- --LogPrefix=gitblit ^
- --StdOutput=auto ^
- --StdError=auto ^
- --StartPath="%gbhome%" ^
- --StartClass=com.gitblit.GitBlitServer ^
- --StartMethod=main ^
- --StartParams="--storePassword;gitblit;--baseFolder;%gbhome%\data" ^
- --StartMode=jvm ^
- --StopPath="%gbhome%" ^
- --StopClass=com.gitblit.GitBlitServer ^
- --StopMethod=main ^
- --StopParams="--stop;--baseFolder;%gbhome%\data" ^
- --StopMode=jvm ^
- --Classpath="%gbhome%\gitblit.jar;%gbhome%\ext\*" ^
- --Jvm=auto ^
- --JvmMx=1024
-
-@ENDLOCAL
diff --git a/src/main/distrib/win/migrate-tickets.cmd b/src/main/distrib/win/migrate-tickets.cmd
deleted file mode 100644
index e08c5a84b..000000000
--- a/src/main/distrib/win/migrate-tickets.cmd
+++ /dev/null
@@ -1,21 +0,0 @@
-@REM --------------------------------------------------------------------------
-@REM This is for migrating Tickets from one service to another.
-@REM
-@REM usage:
-@REM migrate-tickets
-@REM
-@REM --------------------------------------------------------------------------
-@if [%1]==[] goto help
-
-@if [%2]==[] goto help
-
-@java -cp "%~dp0gitblit.jar";"%~dp0ext\*" com.gitblit.MigrateTickets %1 --baseFolder %2
-@goto end
-
-:help
-@echo Please specify the output ticket service and your baseFolder!
-@echo.
-@echo e.g.: migrate-tickets com.gitblit.tickets.RedisTicketService "c:/gitblit data"
-@echo.
-
-:end
diff --git a/src/main/distrib/win/reindex-tickets.cmd b/src/main/distrib/win/reindex-tickets.cmd
deleted file mode 100644
index 49eb122e6..000000000
--- a/src/main/distrib/win/reindex-tickets.cmd
+++ /dev/null
@@ -1,22 +0,0 @@
-@REM --------------------------------------------------------------------------
-@REM This is for reindexing Tickets with Lucene.
-@REM
-@REM Since the Tickets feature is undergoing massive churn it may be necessary
-@REM to reindex tickets due to model or index changes.
-@REM
-@REM usage:
-@REM reindex-tickets
-@REM
-@REM --------------------------------------------------------------------------
-@if [%1]==[] goto nobasefolder
-
-@java -cp "%~dp0gitblit.jar";"%~dp0ext\*" com.gitblit.ReindexTickets --baseFolder %1
-@goto end
-
-:nobasefolder
-@echo Please specify your baseFolder!
-@echo.
-@echo reindex-tickets c:/gitblit-data
-@echo.
-
-:end
diff --git a/src/main/distrib/win/uninstallService.cmd b/src/main/distrib/win/uninstallService.cmd
deleted file mode 100644
index 6a574d198..000000000
--- a/src/main/distrib/win/uninstallService.cmd
+++ /dev/null
@@ -1,9 +0,0 @@
-@SETLOCAL
-
-@REM arch = x86, amd64, or ia32
-SET ARCH=amd64
-
-@REM Delete the gitblit service
-"%~dp0%ARCH%\gitblit.exe" //DS//gitblit
-
-@ENDLOCAL
diff --git a/src/main/distrib/win/x86/gitblit.exe b/src/main/distrib/win/x86/gitblit.exe
deleted file mode 100644
index 75079fafb..000000000
Binary files a/src/main/distrib/win/x86/gitblit.exe and /dev/null differ
diff --git a/src/main/java/.gitignore b/src/main/java/.gitignore
deleted file mode 100644
index 92bb4afa3..000000000
--- a/src/main/java/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/clientapps.json
-/defaults.properties
diff --git a/src/main/java/WEB-INF/web.xml b/src/main/java/WEB-INF/web.xml
deleted file mode 100644
index c648dcdef..000000000
--- a/src/main/java/WEB-INF/web.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
- The base folder is used to specify the root location of your Gitblit data.
- baseFolder
- java.lang.String
- ${contextFolder}/WEB-INF/data
-
-
-
- Gitblit - @gb.version@
-
-
- com.gitblit.servlet.GitblitContext
-
-
-
- guiceFilter
- com.google.inject.servlet.GuiceFilter
-
-
-
- guiceFilter
- /*
-
-
-
- COOKIE
-
-
diff --git a/src/main/java/WEB-INF/weblogic.xml b/src/main/java/WEB-INF/weblogic.xml
deleted file mode 100644
index f41fa00d2..000000000
--- a/src/main/java/WEB-INF/weblogic.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- 12.1.1
- gitblit
-
- true
- true
-
-
diff --git a/src/main/java/com/gitblit/.gitignore b/src/main/java/com/gitblit/.gitignore
deleted file mode 100644
index c62986041..000000000
--- a/src/main/java/com/gitblit/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/SettingKeys.java
-/Keys.java
diff --git a/src/main/java/com/gitblit/AddIndexedBranch.java b/src/main/java/com/gitblit/AddIndexedBranch.java
deleted file mode 100644
index 459e1f00e..000000000
--- a/src/main/java/com/gitblit/AddIndexedBranch.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2012 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-import java.io.File;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.lib.RepositoryCache.FileKey;
-import org.eclipse.jgit.lib.StoredConfig;
-import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
-import org.eclipse.jgit.util.FS;
-import org.kohsuke.args4j.CmdLineException;
-import org.kohsuke.args4j.CmdLineParser;
-import org.kohsuke.args4j.Option;
-
-import com.gitblit.models.RefModel;
-import com.gitblit.utils.ArrayUtils;
-import com.gitblit.utils.JGitUtils;
-import com.gitblit.utils.StringUtils;
-
-/**
- * Utility class to add an indexBranch setting to matching repositories.
- *
- * @author James Moger
- *
- */
-public class AddIndexedBranch {
-
- public static void main(String... args) {
- Params params = new Params();
- CmdLineParser parser = new CmdLineParser(params);
- try {
- parser.parseArgument(args);
- } catch (CmdLineException t) {
- System.err.println(t.getMessage());
- parser.printUsage(System.out);
- return;
- }
-
- // create a lowercase set of excluded repositories
- Set exclusions = new TreeSet();
- for (String exclude : params.exclusions) {
- exclusions.add(exclude.toLowerCase());
- }
-
- // determine available repositories
- File folder = new File(params.folder);
- List repoList = JGitUtils.getRepositoryList(folder, false, true, -1, null);
-
- int modCount = 0;
- int skipCount = 0;
- for (String repo : repoList) {
- boolean skip = false;
- for (String exclusion : exclusions) {
- if (StringUtils.fuzzyMatch(repo, exclusion)) {
- skip = true;
- break;
- }
- }
-
- if (skip) {
- System.out.println("skipping " + repo);
- skipCount++;
- continue;
- }
-
-
- try {
- // load repository config
- File gitDir = FileKey.resolve(new File(folder, repo), FS.DETECTED);
- Repository repository = new FileRepositoryBuilder().setGitDir(gitDir).build();
- StoredConfig config = repository.getConfig();
- config.load();
-
- Set indexedBranches = new LinkedHashSet();
-
- // add all local branches to index
- if (params.addAllLocalBranches) {
- List list = JGitUtils.getLocalBranches(repository, true, -1);
- for (RefModel refModel : list) {
- System.out.println(MessageFormat.format("adding [gitblit] indexBranch={0} for {1}", refModel.getName(), repo));
- indexedBranches.add(refModel.getName());
- }
- }
- else {
- // add only one branch to index ('default' if not specified)
- System.out.println(MessageFormat.format("adding [gitblit] indexBranch={0} for {1}", params.branch, repo));
- indexedBranches.add(params.branch);
- }
-
- String [] branches = config.getStringList("gitblit", null, "indexBranch");
- if (!ArrayUtils.isEmpty(branches)) {
- for (String branch : branches) {
- indexedBranches.add(branch);
- }
- }
- config.setStringList("gitblit", null, "indexBranch", new ArrayList(indexedBranches));
- config.save();
- modCount++;
- } catch (Exception e) {
- System.err.println(repo);
- e.printStackTrace();
- }
- }
-
- System.out.println(MessageFormat.format("updated {0} repository configurations, skipped {1}", modCount, skipCount));
- }
-
-
-
- /**
- * Parameters class for AddIndexedBranch.
- */
- private static class Params {
-
- @Option(name = "--repositoriesFolder", usage = "The root repositories folder ", required = true, metaVar = "PATH")
- public String folder;
-
- @Option(name = "--branch", usage = "The branch to index", metaVar = "BRANCH")
- public String branch = "default";
-
- @Option(name = "--skip", usage = "Skip the named repository (simple fizzy matching is supported)")
- public List exclusions = new ArrayList();
-
- @Option(name = "--all-local-branches", usage = "Add all local branches to index. If specified, the --branch parameter is not considered.")
- public boolean addAllLocalBranches;
- }
-}
diff --git a/src/main/java/com/gitblit/AvatarGenerator.java b/src/main/java/com/gitblit/AvatarGenerator.java
deleted file mode 100644
index 0415f9253..000000000
--- a/src/main/java/com/gitblit/AvatarGenerator.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2015 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-public interface AvatarGenerator {
-
- String getURL(String username, String emailaddress, boolean identicon, int width);
-
-}
diff --git a/src/main/java/com/gitblit/ConfigUserService.java b/src/main/java/com/gitblit/ConfigUserService.java
deleted file mode 100644
index 22d1c190c..000000000
--- a/src/main/java/com/gitblit/ConfigUserService.java
+++ /dev/null
@@ -1,990 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.eclipse.jgit.lib.StoredConfig;
-import org.eclipse.jgit.storage.file.FileBasedConfig;
-import org.eclipse.jgit.util.FS;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.gitblit.Constants.AccessPermission;
-import com.gitblit.Constants.AccountType;
-import com.gitblit.Constants.Role;
-import com.gitblit.Constants.Transport;
-import com.gitblit.manager.IRuntimeManager;
-import com.gitblit.models.TeamModel;
-import com.gitblit.models.UserModel;
-import com.gitblit.models.UserRepositoryPreferences;
-import com.gitblit.utils.ArrayUtils;
-import com.gitblit.utils.DeepCopier;
-import com.gitblit.utils.StringUtils;
-
-/**
- * ConfigUserService is Gitblit's default user service implementation since
- * version 0.8.0.
- *
- * Users and their repository memberships are stored in a git-style config file
- * which is cached and dynamically reloaded when modified. This file is
- * plain-text, human-readable, and may be edited with a text editor.
- *
- * Additionally, this format allows for expansion of the user model without
- * bringing in the complexity of a database.
- *
- * @author James Moger
- *
- */
-public class ConfigUserService implements IUserService {
-
- private static final String TEAM = "team";
-
- private static final String USER = "user";
-
- private static final String PASSWORD = "password";
-
- private static final String DISPLAYNAME = "displayName";
-
- private static final String EMAILADDRESS = "emailAddress";
-
- private static final String ORGANIZATIONALUNIT = "organizationalUnit";
-
- private static final String ORGANIZATION = "organization";
-
- private static final String LOCALITY = "locality";
-
- private static final String STATEPROVINCE = "stateProvince";
-
- private static final String COUNTRYCODE = "countryCode";
-
- private static final String COOKIE = "cookie";
-
- private static final String REPOSITORY = "repository";
-
- private static final String ROLE = "role";
-
- private static final String MAILINGLIST = "mailingList";
-
- private static final String PRERECEIVE = "preReceiveScript";
-
- private static final String POSTRECEIVE = "postReceiveScript";
-
- private static final String STARRED = "starred";
-
- private static final String LOCALE = "locale";
-
- private static final String EMAILONMYTICKETCHANGES = "emailMeOnMyTicketChanges";
-
- private static final String TRANSPORT = "transport";
-
- private static final String ACCOUNTTYPE = "accountType";
-
- private static final String DISABLED = "disabled";
-
- private final File realmFile;
-
- private final Logger logger = LoggerFactory.getLogger(ConfigUserService.class);
-
- private final Map users = new ConcurrentHashMap();
-
- private final Map cookies = new ConcurrentHashMap();
-
- private final Map teams = new ConcurrentHashMap();
-
- private volatile long lastModified;
-
- private volatile boolean forceReload;
-
- public ConfigUserService(File realmFile) {
- this.realmFile = realmFile;
- }
-
- /**
- * Setup the user service.
- *
- * @param runtimeManager
- * @since 1.4.0
- */
- @Override
- public void setup(IRuntimeManager runtimeManager) {
- }
-
- /**
- * Returns the cookie value for the specified user.
- *
- * @param model
- * @return cookie value
- */
- @Override
- public synchronized String getCookie(UserModel model) {
- if (!StringUtils.isEmpty(model.cookie)) {
- return model.cookie;
- }
- UserModel storedModel = getUserModel(model.username);
- if (storedModel == null) {
- return null;
- }
- return storedModel.cookie;
- }
-
- /**
- * Gets the user object for the specified cookie.
- *
- * @param cookie
- * @return a user object or null
- */
- @Override
- public synchronized UserModel getUserModel(char[] cookie) {
- String hash = new String(cookie);
- if (StringUtils.isEmpty(hash)) {
- return null;
- }
- read();
- UserModel model = null;
- if (cookies.containsKey(hash)) {
- model = cookies.get(hash);
- }
-
- if (model != null) {
- // clone the model, otherwise all changes to this object are
- // live and unpersisted
- model = DeepCopier.copy(model);
- }
- return model;
- }
-
- /**
- * Retrieve the user object for the specified username.
- *
- * @param username
- * @return a user object or null
- */
- @Override
- public synchronized UserModel getUserModel(String username) {
- read();
- UserModel model = users.get(username.toLowerCase());
- if (model != null) {
- // clone the model, otherwise all changes to this object are
- // live and unpersisted
- model = DeepCopier.copy(model);
- }
- return model;
- }
-
- /**
- * Updates/writes a complete user object.
- *
- * @param model
- * @return true if update is successful
- */
- @Override
- public synchronized boolean updateUserModel(UserModel model) {
- return updateUserModel(model.username, model);
- }
-
- /**
- * Updates/writes all specified user objects.
- *
- * @param models a list of user models
- * @return true if update is successful
- * @since 1.2.0
- */
- @Override
- public synchronized boolean updateUserModels(Collection models) {
- try {
- read();
- for (UserModel model : models) {
- UserModel originalUser = users.remove(model.username.toLowerCase());
- users.put(model.username.toLowerCase(), model);
- // null check on "final" teams because JSON-sourced UserModel
- // can have a null teams object
- if (model.teams != null) {
- Set userTeams = new HashSet();
- for (TeamModel team : model.teams) {
- TeamModel t = teams.get(team.name.toLowerCase());
- if (t == null) {
- // new team
- t = team;
- teams.put(team.name.toLowerCase(), t);
- }
- // do not clobber existing team definition
- // maybe because this is a federated user
- t.addUser(model.username);
- userTeams.add(t);
- }
- // replace Team-Models in users by new ones.
- model.teams.clear();
- model.teams.addAll(userTeams);
-
- // check for implicit team removal
- if (originalUser != null) {
- for (TeamModel team : originalUser.teams) {
- if (!model.isTeamMember(team.name)) {
- team.removeUser(model.username);
- }
- }
- }
- }
- }
- write();
- return true;
- } catch (Throwable t) {
- logger.error(MessageFormat.format("Failed to update user {0} models!", models.size()),
- t);
- }
- return false;
- }
-
- /**
- * Updates/writes and replaces a complete user object keyed by username.
- * This method allows for renaming a user.
- *
- * @param username
- * the old username
- * @param model
- * the user object to use for username
- * @return true if update is successful
- */
- @Override
- public synchronized boolean updateUserModel(String username, UserModel model) {
- UserModel originalUser = null;
- try {
- if (!model.isLocalAccount()) {
- // do not persist password
- model.password = Constants.EXTERNAL_ACCOUNT;
- }
- read();
- originalUser = users.remove(username.toLowerCase());
- if (originalUser != null) {
- cookies.remove(originalUser.cookie);
- }
- users.put(model.username.toLowerCase(), model);
- // null check on "final" teams because JSON-sourced UserModel
- // can have a null teams object
- if (model.teams != null) {
- for (TeamModel team : model.teams) {
- TeamModel t = teams.get(team.name.toLowerCase());
- if (t == null) {
- // new team
- team.addUser(username);
- teams.put(team.name.toLowerCase(), team);
- } else {
- // do not clobber existing team definition
- // maybe because this is a federated user
- t.removeUser(username);
- t.addUser(model.username);
- }
- }
-
- // check for implicit team removal
- if (originalUser != null) {
- for (TeamModel team : originalUser.teams) {
- if (!model.isTeamMember(team.name)) {
- team.removeUser(username);
- }
- }
- }
- }
- write();
- return true;
- } catch (Throwable t) {
- if (originalUser != null) {
- // restore original user
- users.put(originalUser.username.toLowerCase(), originalUser);
- } else {
- // drop attempted add
- users.remove(model.username.toLowerCase());
- }
- logger.error(MessageFormat.format("Failed to update user model {0}!", model.username),
- t);
- }
- return false;
- }
-
- /**
- * Deletes the user object from the user service.
- *
- * @param model
- * @return true if successful
- */
- @Override
- public synchronized boolean deleteUserModel(UserModel model) {
- return deleteUser(model.username);
- }
-
- /**
- * Delete the user object with the specified username
- *
- * @param username
- * @return true if successful
- */
- @Override
- public synchronized boolean deleteUser(String username) {
- try {
- // Read realm file
- read();
- UserModel model = users.remove(username.toLowerCase());
- if (model == null) {
- // user does not exist
- return false;
- }
- // remove user from team
- for (TeamModel team : model.teams) {
- TeamModel t = teams.get(team.name);
- if (t == null) {
- // new team
- team.removeUser(username);
- teams.put(team.name.toLowerCase(), team);
- } else {
- // existing team
- t.removeUser(username);
- }
- }
- write();
- return true;
- } catch (Throwable t) {
- logger.error(MessageFormat.format("Failed to delete user {0}!", username), t);
- }
- return false;
- }
-
- /**
- * Returns the list of all teams available to the login service.
- *
- * @return list of all teams
- * @since 0.8.0
- */
- @Override
- public synchronized List getAllTeamNames() {
- read();
- List list = new ArrayList(teams.keySet());
- Collections.sort(list);
- return list;
- }
-
- /**
- * Returns the list of all teams available to the login service.
- *
- * @return list of all teams
- * @since 0.8.0
- */
- @Override
- public synchronized List getAllTeams() {
- read();
- List list = new ArrayList(teams.values());
- list = DeepCopier.copy(list);
- Collections.sort(list);
- return list;
- }
-
- /**
- * Returns the list of all users who are allowed to bypass the access
- * restriction placed on the specified repository.
- *
- * @param role
- * the repository name
- * @return list of all usernames that can bypass the access restriction
- */
- @Override
- public synchronized List getTeamNamesForRepositoryRole(String role) {
- List list = new ArrayList();
- try {
- read();
- for (Map.Entry entry : teams.entrySet()) {
- TeamModel model = entry.getValue();
- if (model.hasRepositoryPermission(role)) {
- list.add(model.name);
- }
- }
- } catch (Throwable t) {
- logger.error(MessageFormat.format("Failed to get teamnames for role {0}!", role), t);
- }
- Collections.sort(list);
- return list;
- }
-
- /**
- * Retrieve the team object for the specified team name.
- *
- * @param teamname
- * @return a team object or null
- * @since 0.8.0
- */
- @Override
- public synchronized TeamModel getTeamModel(String teamname) {
- read();
- TeamModel model = teams.get(teamname.toLowerCase());
- if (model != null) {
- // clone the model, otherwise all changes to this object are
- // live and unpersisted
- model = DeepCopier.copy(model);
- }
- return model;
- }
-
- /**
- * Updates/writes a complete team object.
- *
- * @param model
- * @return true if update is successful
- * @since 0.8.0
- */
- @Override
- public synchronized boolean updateTeamModel(TeamModel model) {
- return updateTeamModel(model.name, model);
- }
-
- /**
- * Updates/writes all specified team objects.
- *
- * @param models a list of team models
- * @return true if update is successful
- * @since 1.2.0
- */
- @Override
- public synchronized boolean updateTeamModels(Collection models) {
- try {
- read();
- for (TeamModel team : models) {
- teams.put(team.name.toLowerCase(), team);
- }
- write();
- return true;
- } catch (Throwable t) {
- logger.error(MessageFormat.format("Failed to update team {0} models!", models.size()), t);
- }
- return false;
- }
-
- /**
- * Updates/writes and replaces a complete team object keyed by teamname.
- * This method allows for renaming a team.
- *
- * @param teamname
- * the old teamname
- * @param model
- * the team object to use for teamname
- * @return true if update is successful
- * @since 0.8.0
- */
- @Override
- public synchronized boolean updateTeamModel(String teamname, TeamModel model) {
- TeamModel original = null;
- try {
- read();
- original = teams.remove(teamname.toLowerCase());
- teams.put(model.name.toLowerCase(), model);
- write();
- return true;
- } catch (Throwable t) {
- if (original != null) {
- // restore original team
- teams.put(original.name.toLowerCase(), original);
- } else {
- // drop attempted add
- teams.remove(model.name.toLowerCase());
- }
- logger.error(MessageFormat.format("Failed to update team model {0}!", model.name), t);
- }
- return false;
- }
-
- /**
- * Deletes the team object from the user service.
- *
- * @param model
- * @return true if successful
- * @since 0.8.0
- */
- @Override
- public synchronized boolean deleteTeamModel(TeamModel model) {
- return deleteTeam(model.name);
- }
-
- /**
- * Delete the team object with the specified teamname
- *
- * @param teamname
- * @return true if successful
- * @since 0.8.0
- */
- @Override
- public synchronized boolean deleteTeam(String teamname) {
- try {
- // Read realm file
- read();
- teams.remove(teamname.toLowerCase());
- write();
- return true;
- } catch (Throwable t) {
- logger.error(MessageFormat.format("Failed to delete team {0}!", teamname), t);
- }
- return false;
- }
-
- /**
- * Returns the list of all users available to the login service.
- *
- * @return list of all usernames
- */
- @Override
- public synchronized List getAllUsernames() {
- read();
- List list = new ArrayList(users.keySet());
- Collections.sort(list);
- return list;
- }
-
- /**
- * Returns the list of all users available to the login service.
- *
- * @return list of all usernames
- */
- @Override
- public synchronized List getAllUsers() {
- read();
- List list = new ArrayList(users.values());
- list = DeepCopier.copy(list);
- Collections.sort(list);
- return list;
- }
-
- /**
- * Returns the list of all users who are allowed to bypass the access
- * restriction placed on the specified repository.
- *
- * @param role
- * the repository name
- * @return list of all usernames that can bypass the access restriction
- */
- @Override
- public synchronized List getUsernamesForRepositoryRole(String role) {
- List list = new ArrayList();
- try {
- read();
- for (Map.Entry entry : users.entrySet()) {
- UserModel model = entry.getValue();
- if (model.hasRepositoryPermission(role)) {
- list.add(model.username);
- }
- }
- } catch (Throwable t) {
- logger.error(MessageFormat.format("Failed to get usernames for role {0}!", role), t);
- }
- Collections.sort(list);
- return list;
- }
-
- /**
- * Renames a repository role.
- *
- * @param oldRole
- * @param newRole
- * @return true if successful
- */
- @Override
- public synchronized boolean renameRepositoryRole(String oldRole, String newRole) {
- try {
- read();
- // identify users which require role rename
- for (UserModel model : users.values()) {
- if (model.hasRepositoryPermission(oldRole)) {
- AccessPermission permission = model.removeRepositoryPermission(oldRole);
- model.setRepositoryPermission(newRole, permission);
- }
- }
-
- // identify teams which require role rename
- for (TeamModel model : teams.values()) {
- if (model.hasRepositoryPermission(oldRole)) {
- AccessPermission permission = model.removeRepositoryPermission(oldRole);
- model.setRepositoryPermission(newRole, permission);
- }
- }
- // persist changes
- write();
- return true;
- } catch (Throwable t) {
- logger.error(
- MessageFormat.format("Failed to rename role {0} to {1}!", oldRole, newRole), t);
- }
- return false;
- }
-
- /**
- * Removes a repository role from all users.
- *
- * @param role
- * @return true if successful
- */
- @Override
- public synchronized boolean deleteRepositoryRole(String role) {
- try {
- read();
-
- // identify users which require role rename
- for (UserModel user : users.values()) {
- user.removeRepositoryPermission(role);
- }
-
- // identify teams which require role rename
- for (TeamModel team : teams.values()) {
- team.removeRepositoryPermission(role);
- }
-
- // persist changes
- write();
- return true;
- } catch (Throwable t) {
- logger.error(MessageFormat.format("Failed to delete role {0}!", role), t);
- }
- return false;
- }
-
- /**
- * Writes the properties file.
- *
- * @throws IOException
- */
- private synchronized void write() throws IOException {
- // Write a temporary copy of the users file
- File realmFileCopy = new File(realmFile.getAbsolutePath() + ".tmp");
-
- StoredUserConfig config = new StoredUserConfig(realmFileCopy);
-
- // write users
- for (UserModel model : users.values()) {
- if (!StringUtils.isEmpty(model.password)) {
- config.setString(USER, model.username, PASSWORD, model.password);
- }
- if (!StringUtils.isEmpty(model.cookie)) {
- config.setString(USER, model.username, COOKIE, model.cookie);
- }
- if (!StringUtils.isEmpty(model.displayName)) {
- config.setString(USER, model.username, DISPLAYNAME, model.displayName);
- }
- if (!StringUtils.isEmpty(model.emailAddress)) {
- config.setString(USER, model.username, EMAILADDRESS, model.emailAddress);
- }
- if (model.accountType != null) {
- config.setString(USER, model.username, ACCOUNTTYPE, model.accountType.name());
- }
- if (!StringUtils.isEmpty(model.organizationalUnit)) {
- config.setString(USER, model.username, ORGANIZATIONALUNIT, model.organizationalUnit);
- }
- if (!StringUtils.isEmpty(model.organization)) {
- config.setString(USER, model.username, ORGANIZATION, model.organization);
- }
- if (!StringUtils.isEmpty(model.locality)) {
- config.setString(USER, model.username, LOCALITY, model.locality);
- }
- if (!StringUtils.isEmpty(model.stateProvince)) {
- config.setString(USER, model.username, STATEPROVINCE, model.stateProvince);
- }
- if (!StringUtils.isEmpty(model.countryCode)) {
- config.setString(USER, model.username, COUNTRYCODE, model.countryCode);
- }
- if (model.disabled) {
- config.setBoolean(USER, model.username, DISABLED, true);
- }
- if (model.getPreferences() != null) {
- Locale locale = model.getPreferences().getLocale();
- if (locale != null) {
- String val;
- if (StringUtils.isEmpty(locale.getCountry())) {
- val = locale.getLanguage();
- } else {
- val = locale.getLanguage() + "_" + locale.getCountry();
- }
- config.setString(USER, model.username, LOCALE, val);
- }
-
- config.setBoolean(USER, model.username, EMAILONMYTICKETCHANGES, model.getPreferences().isEmailMeOnMyTicketChanges());
-
- if (model.getPreferences().getTransport() != null) {
- config.setString(USER, model.username, TRANSPORT, model.getPreferences().getTransport().name());
- }
- }
-
- // user roles
- List roles = new ArrayList();
- if (model.canAdmin) {
- roles.add(Role.ADMIN.getRole());
- }
- if (model.canFork) {
- roles.add(Role.FORK.getRole());
- }
- if (model.canCreate) {
- roles.add(Role.CREATE.getRole());
- }
- if (model.excludeFromFederation) {
- roles.add(Role.NOT_FEDERATED.getRole());
- }
- if (roles.size() == 0) {
- // we do this to ensure that user record with no password
- // is written. otherwise, StoredConfig optimizes that account
- // away. :(
- roles.add(Role.NONE.getRole());
- }
- config.setStringList(USER, model.username, ROLE, roles);
-
- // discrete repository permissions
- if (model.permissions != null && !model.canAdmin) {
- List permissions = new ArrayList();
- for (Map.Entry entry : model.permissions.entrySet()) {
- if (entry.getValue().exceeds(AccessPermission.NONE)) {
- permissions.add(entry.getValue().asRole(entry.getKey()));
- }
- }
- config.setStringList(USER, model.username, REPOSITORY, permissions);
- }
-
- // user preferences
- if (model.getPreferences() != null) {
- List starred = model.getPreferences().getStarredRepositories();
- if (starred.size() > 0) {
- config.setStringList(USER, model.username, STARRED, starred);
- }
- }
- }
-
- // write teams
- for (TeamModel model : teams.values()) {
- // team roles
- List roles = new ArrayList();
- if (model.canAdmin) {
- roles.add(Role.ADMIN.getRole());
- }
- if (model.canFork) {
- roles.add(Role.FORK.getRole());
- }
- if (model.canCreate) {
- roles.add(Role.CREATE.getRole());
- }
- if (roles.size() == 0) {
- // we do this to ensure that team record is written.
- // Otherwise, StoredConfig might optimizes that record away.
- roles.add(Role.NONE.getRole());
- }
- config.setStringList(TEAM, model.name, ROLE, roles);
- if (model.accountType != null) {
- config.setString(TEAM, model.name, ACCOUNTTYPE, model.accountType.name());
- }
-
- if (!model.canAdmin) {
- // write team permission for non-admin teams
- if (model.permissions == null) {
- // null check on "final" repositories because JSON-sourced TeamModel
- // can have a null repositories object
- if (!ArrayUtils.isEmpty(model.repositories)) {
- config.setStringList(TEAM, model.name, REPOSITORY, new ArrayList(
- model.repositories));
- }
- } else {
- // discrete repository permissions
- List permissions = new ArrayList();
- for (Map.Entry entry : model.permissions.entrySet()) {
- if (entry.getValue().exceeds(AccessPermission.NONE)) {
- // code:repository (e.g. RW+:~james/myrepo.git
- permissions.add(entry.getValue().asRole(entry.getKey()));
- }
- }
- config.setStringList(TEAM, model.name, REPOSITORY, permissions);
- }
- }
-
- // null check on "final" users because JSON-sourced TeamModel
- // can have a null users object
- if (!ArrayUtils.isEmpty(model.users)) {
- config.setStringList(TEAM, model.name, USER, new ArrayList(model.users));
- }
-
- // null check on "final" mailing lists because JSON-sourced
- // TeamModel can have a null users object
- if (!ArrayUtils.isEmpty(model.mailingLists)) {
- config.setStringList(TEAM, model.name, MAILINGLIST, new ArrayList(
- model.mailingLists));
- }
-
- // null check on "final" preReceiveScripts because JSON-sourced
- // TeamModel can have a null preReceiveScripts object
- if (!ArrayUtils.isEmpty(model.preReceiveScripts)) {
- config.setStringList(TEAM, model.name, PRERECEIVE, model.preReceiveScripts);
- }
-
- // null check on "final" postReceiveScripts because JSON-sourced
- // TeamModel can have a null postReceiveScripts object
- if (!ArrayUtils.isEmpty(model.postReceiveScripts)) {
- config.setStringList(TEAM, model.name, POSTRECEIVE, model.postReceiveScripts);
- }
- }
-
- config.save();
- // manually set the forceReload flag because not all JVMs support real
- // millisecond resolution of lastModified. (issue-55)
- forceReload = true;
-
- // If the write is successful, delete the current file and rename
- // the temporary copy to the original filename.
- if (realmFileCopy.exists() && realmFileCopy.length() > 0) {
- if (realmFile.exists()) {
- if (!realmFile.delete()) {
- throw new IOException(MessageFormat.format("Failed to delete {0}!",
- realmFile.getAbsolutePath()));
- }
- }
- if (!realmFileCopy.renameTo(realmFile)) {
- throw new IOException(MessageFormat.format("Failed to rename {0} to {1}!",
- realmFileCopy.getAbsolutePath(), realmFile.getAbsolutePath()));
- }
- } else {
- throw new IOException(MessageFormat.format("Failed to save {0}!",
- realmFileCopy.getAbsolutePath()));
- }
- }
-
- /**
- * Reads the realm file and rebuilds the in-memory lookup tables.
- */
- protected synchronized void read() {
- if (realmFile.exists() && (forceReload || (realmFile.lastModified() != lastModified))) {
- forceReload = false;
- lastModified = realmFile.lastModified();
- users.clear();
- cookies.clear();
- teams.clear();
-
- try {
- StoredConfig config = new FileBasedConfig(realmFile, FS.detect());
- config.load();
- Set usernames = config.getSubsections(USER);
- for (String username : usernames) {
- UserModel user = new UserModel(username.toLowerCase());
- user.password = config.getString(USER, username, PASSWORD);
- user.displayName = config.getString(USER, username, DISPLAYNAME);
- user.emailAddress = config.getString(USER, username, EMAILADDRESS);
- user.accountType = AccountType.fromString(config.getString(USER, username, ACCOUNTTYPE));
- user.disabled = config.getBoolean(USER, username, DISABLED, false);
- user.organizationalUnit = config.getString(USER, username, ORGANIZATIONALUNIT);
- user.organization = config.getString(USER, username, ORGANIZATION);
- user.locality = config.getString(USER, username, LOCALITY);
- user.stateProvince = config.getString(USER, username, STATEPROVINCE);
- user.countryCode = config.getString(USER, username, COUNTRYCODE);
- user.cookie = config.getString(USER, username, COOKIE);
- if (StringUtils.isEmpty(user.cookie) && !StringUtils.isEmpty(user.password)) {
- user.cookie = user.createCookie();
- }
-
- // preferences
- user.getPreferences().setLocale(config.getString(USER, username, LOCALE));
- user.getPreferences().setEmailMeOnMyTicketChanges(config.getBoolean(USER, username, EMAILONMYTICKETCHANGES, true));
- user.getPreferences().setTransport(Transport.fromString(config.getString(USER, username, TRANSPORT)));
-
- // user roles
- Set roles = new HashSet(Arrays.asList(config.getStringList(
- USER, username, ROLE)));
- user.canAdmin = roles.contains(Role.ADMIN.getRole());
- user.canFork = roles.contains(Role.FORK.getRole());
- user.canCreate = roles.contains(Role.CREATE.getRole());
- user.excludeFromFederation = roles.contains(Role.NOT_FEDERATED.getRole());
-
- // repository memberships
- if (!user.canAdmin) {
- // non-admin, read permissions
- Set repositories = new HashSet(Arrays.asList(config
- .getStringList(USER, username, REPOSITORY)));
- for (String repository : repositories) {
- user.addRepositoryPermission(repository);
- }
- }
-
- // starred repositories
- Set starred = new HashSet(Arrays.asList(config
- .getStringList(USER, username, STARRED)));
- for (String repository : starred) {
- UserRepositoryPreferences prefs = user.getPreferences().getRepositoryPreferences(repository);
- prefs.starred = true;
- }
-
- // update cache
- users.put(user.username, user);
- if (!StringUtils.isEmpty(user.cookie)) {
- cookies.put(user.cookie, user);
- }
- }
-
- // load the teams
- Set teamnames = config.getSubsections(TEAM);
- for (String teamname : teamnames) {
- TeamModel team = new TeamModel(teamname);
- Set roles = new HashSet(Arrays.asList(config.getStringList(
- TEAM, teamname, ROLE)));
- team.canAdmin = roles.contains(Role.ADMIN.getRole());
- team.canFork = roles.contains(Role.FORK.getRole());
- team.canCreate = roles.contains(Role.CREATE.getRole());
- team.accountType = AccountType.fromString(config.getString(TEAM, teamname, ACCOUNTTYPE));
-
- if (!team.canAdmin) {
- // non-admin team, read permissions
- team.addRepositoryPermissions(Arrays.asList(config.getStringList(TEAM, teamname,
- REPOSITORY)));
- }
- team.addUsers(Arrays.asList(config.getStringList(TEAM, teamname, USER)));
- team.addMailingLists(Arrays.asList(config.getStringList(TEAM, teamname,
- MAILINGLIST)));
- team.preReceiveScripts.addAll(Arrays.asList(config.getStringList(TEAM,
- teamname, PRERECEIVE)));
- team.postReceiveScripts.addAll(Arrays.asList(config.getStringList(TEAM,
- teamname, POSTRECEIVE)));
-
- teams.put(team.name.toLowerCase(), team);
-
- // set the teams on the users
- for (String user : team.users) {
- UserModel model = users.get(user);
- if (model != null) {
- model.teams.add(team);
- }
- }
- }
- } catch (Exception e) {
- logger.error(MessageFormat.format("Failed to read {0}", realmFile), e);
- }
- }
- }
-
- protected long lastModified() {
- return lastModified;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "(" + realmFile.getAbsolutePath() + ")";
- }
-}
diff --git a/src/main/java/com/gitblit/Constants.java b/src/main/java/com/gitblit/Constants.java
deleted file mode 100644
index c73bc24b7..000000000
--- a/src/main/java/com/gitblit/Constants.java
+++ /dev/null
@@ -1,705 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-/**
- * Constant values used by Gitblit.
- *
- * @author James Moger
- *
- */
-public class Constants {
-
- public static final String NAME = "Gitblit";
-
- public static final String FULL_NAME = "Gitblit - a pure Java Git solution";
-
- @Deprecated
- public static final String ADMIN_ROLE = "#admin";
-
- @Deprecated
- public static final String FORK_ROLE = "#fork";
-
- @Deprecated
- public static final String CREATE_ROLE = "#create";
-
- @Deprecated
- public static final String NOT_FEDERATED_ROLE = "#notfederated";
-
- @Deprecated
- public static final String NO_ROLE = "#none";
-
- public static final String EXTERNAL_ACCOUNT = "#externalAccount";
-
- public static final String PROPERTIES_FILE = "gitblit.properties";
-
- public static final String DEFAULT_USER_REPOSITORY_PREFIX = "~";
-
- public static final String R_PATH = "/r/";
-
- public static final String GIT_PATH = "/git/";
-
- public static final String REGEX_SHA256 = "[a-fA-F0-9]{64}";
-
- /**
- * This regular expression is used when searching for "mentions" in tickets
- * (when someone writes @thisOtherUser)
- */
- public static final String REGEX_TICKET_MENTION = "\\B@(?[^\\s]+)\\b";
-
- public static final String ZIP_PATH = "/zip/";
-
- public static final String SYNDICATION_PATH = "/feed/";
-
- public static final String FEDERATION_PATH = "/federation/";
-
- public static final String RPC_PATH = "/rpc/";
-
- public static final String PAGES = "/pages/";
-
- public static final String SPARKLESHARE_INVITE_PATH = "/sparkleshare/";
-
- public static final String RAW_PATH = "/raw/";
-
- public static final String PT_PATH = "/pt";
-
- public static final String BRANCH_GRAPH_PATH = "/graph/";
-
- public static final String BORDER = "*****************************************************************";
-
- public static final String BORDER2 = "#################################################################";
-
- public static final String FEDERATION_USER = "$gitblit";
-
- public static final String PROPOSAL_EXT = ".json";
-
- public static final String ENCODING = "UTF-8";
-
- public static final int LEN_SHORTLOG = 78;
-
- public static final int LEN_SHORTLOG_REFS = 60;
-
- public static final int LEN_FILESTORE_META_MIN = 125;
-
- public static final int LEN_FILESTORE_META_MAX = 146;
-
- public static final String DEFAULT_BRANCH = "default";
-
- public static final String CONFIG_GITBLIT = "gitblit";
-
- public static final String CONFIG_CUSTOM_FIELDS = "customFields";
-
- public static final String ISO8601 = "yyyy-MM-dd'T'HH:mm:ssZ";
-
- public static final String baseFolder = "baseFolder";
-
- public static final String baseFolder$ = "${" + baseFolder + "}";
-
- public static final String contextFolder$ = "${contextFolder}";
-
- public static final String HEAD = "HEAD";
-
- public static final String R_META = "refs/meta/";
-
- public static final String R_HEADS = "refs/heads/";
-
- public static final String R_NOTES = "refs/notes/";
-
- public static final String R_CHANGES = "refs/changes/";
-
- public static final String R_PULL = "refs/pull/";
-
- public static final String R_TAGS = "refs/tags/";
-
- public static final String R_REMOTES = "refs/remotes/";
-
- public static final String R_FOR = "refs/for/";
-
- public static final String R_TICKET = "refs/heads/ticket/";
-
- public static final String R_TICKETS_PATCHSETS = "refs/tickets/";
-
- public static final String R_MASTER = "refs/heads/master";
-
- public static final String MASTER = "master";
-
- public static final String R_DEVELOP = "refs/heads/develop";
-
- public static final String DEVELOP = "develop";
-
- public static final String ATTRIB_AUTHTYPE = NAME + ":authentication-type";
-
- public static final String ATTRIB_AUTHUSER = NAME + ":authenticated-user";
-
- public static final String R_LFS = "info/lfs/";
-
- public static String getVersion() {
- String v = Constants.class.getPackage().getImplementationVersion();
- if (v == null) {
- return "0.0.0-SNAPSHOT";
- }
- return v;
- }
-
- public static String getGitBlitVersion() {
- return NAME + " v" + getVersion();
- }
-
- public static String getBuildDate() {
- return getManifestValue("build-date", "PENDING");
- }
-
- public static String getASCIIArt() {
- StringBuilder sb = new StringBuilder();
- sb.append(" _____ _ _ _ _ _ _").append('\n');
- sb.append(" | __ \\(_)| | | | | |(_)| |").append('\n');
- sb.append(" | | \\/ _ | |_ | |__ | | _ | |_").append('\n');
- sb.append(" | | __ | || __|| '_ \\ | || || __|").append(" ").append("http://gitblit.com").append('\n');
- sb.append(" | |_\\ \\| || |_ | |_) || || || |_").append(" ").append("@gitblit").append('\n');
- sb.append(" \\____/|_| \\__||_.__/ |_||_| \\__|").append(" ").append(Constants.getVersion()).append('\n');
- return sb.toString();
- }
-
- private static String getManifestValue(String attrib, String defaultValue) {
- Class> clazz = Constants.class;
- String className = clazz.getSimpleName() + ".class";
- String classPath = clazz.getResource(className).toString();
- if (!classPath.startsWith("jar")) {
- // Class not from JAR
- return defaultValue;
- }
- try {
- String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF";
- Manifest manifest = new Manifest(new URL(manifestPath).openStream());
- Attributes attr = manifest.getMainAttributes();
- String value = attr.getValue(attrib);
- return value;
- } catch (Exception e) {
- }
- return defaultValue;
- }
-
- public static enum Role {
- NONE, ADMIN, CREATE, FORK, NOT_FEDERATED;
-
- public String getRole() {
- return "#" + name().replace("_", "").toLowerCase();
- }
-
- @Override
- public String toString() {
- return getRole();
- }
- }
-
- /**
- * Enumeration representing the four access restriction levels.
- */
- public static enum AccessRestrictionType {
- NONE, PUSH, CLONE, VIEW;
-
- private static final AccessRestrictionType [] AUTH_TYPES = { PUSH, CLONE, VIEW };
-
- public static AccessRestrictionType fromName(String name) {
- for (AccessRestrictionType type : values()) {
- if (type.name().equalsIgnoreCase(name)) {
- return type;
- }
- }
- return NONE;
- }
-
- public static List choices(boolean allowAnonymousPush) {
- if (allowAnonymousPush) {
- return Arrays.asList(values());
- }
- return Arrays.asList(AUTH_TYPES);
- }
-
- public boolean exceeds(AccessRestrictionType type) {
- return this.ordinal() > type.ordinal();
- }
-
- public boolean atLeast(AccessRestrictionType type) {
- return this.ordinal() >= type.ordinal();
- }
-
- @Override
- public String toString() {
- return name();
- }
-
- public boolean isValidPermission(AccessPermission permission) {
- switch (this) {
- case VIEW:
- // VIEW restriction
- // all access permissions are valid
- return true;
- case CLONE:
- // CLONE restriction
- // only CLONE or greater access permissions are valid
- return permission.atLeast(AccessPermission.CLONE);
- case PUSH:
- // PUSH restriction
- // only PUSH or greater access permissions are valid
- return permission.atLeast(AccessPermission.PUSH);
- case NONE:
- // NO access restriction
- // all access permissions are invalid
- return false;
- }
- return false;
- }
- }
-
- /**
- * Enumeration representing the types of authorization control for an
- * access restricted resource.
- */
- public static enum AuthorizationControl {
- AUTHENTICATED, NAMED;
-
- public static AuthorizationControl fromName(String name) {
- for (AuthorizationControl type : values()) {
- if (type.name().equalsIgnoreCase(name)) {
- return type;
- }
- }
- return NAMED;
- }
-
- @Override
- public String toString() {
- return name();
- }
- }
-
-
- /**
- * Enumeration representing the types of federation tokens.
- */
- public static enum FederationToken {
- ALL, USERS_AND_REPOSITORIES, REPOSITORIES;
-
- public static FederationToken fromName(String name) {
- for (FederationToken type : values()) {
- if (type.name().equalsIgnoreCase(name)) {
- return type;
- }
- }
- return REPOSITORIES;
- }
-
- @Override
- public String toString() {
- return name();
- }
- }
-
- /**
- * Enumeration representing the types of federation requests.
- */
- public static enum FederationRequest {
- POKE, PROPOSAL, PULL_REPOSITORIES, PULL_USERS, PULL_TEAMS, PULL_SETTINGS, PULL_SCRIPTS, STATUS;
-
- public static FederationRequest fromName(String name) {
- for (FederationRequest type : values()) {
- if (type.name().equalsIgnoreCase(name)) {
- return type;
- }
- }
- return PULL_REPOSITORIES;
- }
-
- @Override
- public String toString() {
- return name();
- }
- }
-
- /**
- * Enumeration representing the statii of federation requests.
- */
- public static enum FederationPullStatus {
- PENDING, FAILED, SKIPPED, PULLED, MIRRORED, NOCHANGE, EXCLUDED;
-
- public static FederationPullStatus fromName(String name) {
- for (FederationPullStatus type : values()) {
- if (type.name().equalsIgnoreCase(name)) {
- return type;
- }
- }
- return PENDING;
- }
-
- @Override
- public String toString() {
- return name();
- }
- }
-
- /**
- * Enumeration representing the federation types.
- */
- public static enum FederationStrategy {
- EXCLUDE, FEDERATE_THIS, FEDERATE_ORIGIN;
-
- public static FederationStrategy fromName(String name) {
- for (FederationStrategy type : values()) {
- if (type.name().equalsIgnoreCase(name)) {
- return type;
- }
- }
- return FEDERATE_THIS;
- }
-
- public boolean exceeds(FederationStrategy type) {
- return this.ordinal() > type.ordinal();
- }
-
- public boolean atLeast(FederationStrategy type) {
- return this.ordinal() >= type.ordinal();
- }
-
- @Override
- public String toString() {
- return name();
- }
- }
-
- /**
- * Enumeration representing the possible results of federation proposal
- * requests.
- */
- public static enum FederationProposalResult {
- ERROR, FEDERATION_DISABLED, MISSING_DATA, NO_PROPOSALS, NO_POKE, ACCEPTED;
-
- @Override
- public String toString() {
- return name();
- }
- }
-
- /**
- * Enumeration representing the possible remote procedure call requests from
- * a client.
- */
- public static enum RpcRequest {
- // Order is important here. anything after LIST_SETTINGS requires
- // administrator privileges and web.allowRpcManagement.
- CLEAR_REPOSITORY_CACHE, REINDEX_TICKETS, GET_PROTOCOL, LIST_REPOSITORIES, LIST_BRANCHES, GET_USER,
- FORK_REPOSITORY, LIST_SETTINGS,
- CREATE_REPOSITORY, EDIT_REPOSITORY, DELETE_REPOSITORY,
- LIST_USERS, CREATE_USER, EDIT_USER, DELETE_USER,
- LIST_TEAMS, CREATE_TEAM, EDIT_TEAM, DELETE_TEAM,
- LIST_REPOSITORY_MEMBERS, SET_REPOSITORY_MEMBERS, LIST_REPOSITORY_TEAMS, SET_REPOSITORY_TEAMS,
- LIST_REPOSITORY_MEMBER_PERMISSIONS, SET_REPOSITORY_MEMBER_PERMISSIONS, LIST_REPOSITORY_TEAM_PERMISSIONS, SET_REPOSITORY_TEAM_PERMISSIONS,
- LIST_FEDERATION_REGISTRATIONS, LIST_FEDERATION_RESULTS, LIST_FEDERATION_PROPOSALS, LIST_FEDERATION_SETS,
- EDIT_SETTINGS, LIST_STATUS;
-
- public static RpcRequest fromName(String name) {
- for (RpcRequest type : values()) {
- if (type.name().equalsIgnoreCase(name)) {
- return type;
- }
- }
- return null;
- }
-
- public boolean exceeds(RpcRequest type) {
- return this.ordinal() > type.ordinal();
- }
-
- @Override
- public String toString() {
- return name();
- }
- }
-
- /**
- * Enumeration of the search types.
- */
- public static enum SearchType {
- AUTHOR, COMMITTER, COMMIT;
-
- public static SearchType forName(String name) {
- for (SearchType type : values()) {
- if (type.name().equalsIgnoreCase(name)) {
- return type;
- }
- }
- return COMMIT;
- }
-
- @Override
- public String toString() {
- return name().toLowerCase();
- }
- }
-
- /**
- * Enumeration of the feed content object types.
- */
- public static enum FeedObjectType {
- COMMIT, TAG;
-
- public static FeedObjectType forName(String name) {
- for (FeedObjectType type : values()) {
- if (type.name().equalsIgnoreCase(name)) {
- return type;
- }
- }
- return COMMIT;
- }
-
- @Override
- public String toString() {
- return name().toLowerCase();
- }
- }
-
- /**
- * The types of objects that can be indexed and queried.
- */
- public static enum SearchObjectType {
- commit, blob;
-
- public static SearchObjectType fromName(String name) {
- for (SearchObjectType value : values()) {
- if (value.name().equals(name)) {
- return value;
- }
- }
- return null;
- }
- }
-
- /**
- * The access permissions available for a repository.
- */
- public static enum AccessPermission {
- NONE("N"), EXCLUDE("X"), VIEW("V"), CLONE("R"), PUSH("RW"), CREATE("RWC"), DELETE("RWD"), REWIND("RW+"), OWNER("RW+");
-
- public static final AccessPermission [] NEWPERMISSIONS = { EXCLUDE, VIEW, CLONE, PUSH, CREATE, DELETE, REWIND };
-
- public static final AccessPermission [] SSHPERMISSIONS = { VIEW, CLONE, PUSH };
-
- public static AccessPermission LEGACY = REWIND;
-
- public final String code;
-
- private AccessPermission(String code) {
- this.code = code;
- }
-
- public boolean atMost(AccessPermission perm) {
- return ordinal() <= perm.ordinal();
- }
-
- public boolean atLeast(AccessPermission perm) {
- return ordinal() >= perm.ordinal();
- }
-
- public boolean exceeds(AccessPermission perm) {
- return ordinal() > perm.ordinal();
- }
-
- public String asRole(String repository) {
- return code + ":" + repository;
- }
-
- @Override
- public String toString() {
- return code;
- }
-
- public static AccessPermission permissionFromRole(String role) {
- String [] fields = role.split(":", 2);
- if (fields.length == 1) {
- // legacy/undefined assume full permissions
- return AccessPermission.LEGACY;
- } else {
- // code:repository
- return AccessPermission.fromCode(fields[0]);
- }
- }
-
- public static String repositoryFromRole(String role) {
- String [] fields = role.split(":", 2);
- if (fields.length == 1) {
- // legacy/undefined assume full permissions
- return role;
- } else {
- // code:repository
- return fields[1];
- }
- }
-
- public static AccessPermission fromCode(String code) {
- for (AccessPermission perm : values()) {
- if (perm.code.equalsIgnoreCase(code)) {
- return perm;
- }
- }
- return AccessPermission.NONE;
- }
- }
-
- public static enum RegistrantType {
- REPOSITORY, USER, TEAM;
- }
-
- public static enum PermissionType {
- MISSING, ANONYMOUS, EXPLICIT, TEAM, REGEX, OWNER, ADMINISTRATOR;
- }
-
- public static enum GCStatus {
- READY, COLLECTING;
-
- public boolean exceeds(GCStatus s) {
- return ordinal() > s.ordinal();
- }
- }
-
- public static enum AuthenticationType {
- PUBLIC_KEY, CREDENTIALS, COOKIE, CERTIFICATE, CONTAINER, HTTPHEADER;
-
- public boolean isStandard() {
- return ordinal() <= COOKIE.ordinal();
- }
- }
-
- public static enum AccountType {
- LOCAL, CONTAINER, LDAP, REDMINE, SALESFORCE, WINDOWS, PAM, HTPASSWD, HTTPHEADER;
-
- public static AccountType fromString(String value) {
- for (AccountType type : AccountType.values()) {
- if (type.name().equalsIgnoreCase(value)) {
- return type;
- }
- }
- return AccountType.LOCAL;
- }
-
- public boolean isLocal() {
- return this == LOCAL;
- }
- }
-
- public static enum CommitMessageRenderer {
- PLAIN, MARKDOWN;
-
- public static CommitMessageRenderer fromName(String name) {
- for (CommitMessageRenderer renderer : values()) {
- if (renderer.name().equalsIgnoreCase(name)) {
- return renderer;
- }
- }
- return CommitMessageRenderer.PLAIN;
- }
- }
-
- public static enum Transport {
- // ordered for url advertisements, assuming equal access permissions
- SSH, HTTPS, HTTP, GIT;
-
- public static Transport fromString(String value) {
- for (Transport t : values()) {
- if (t.name().equalsIgnoreCase(value)) {
- return t;
- }
- }
- return null;
- }
-
- public static Transport fromUrl(String url) {
- int delim = url.indexOf("://");
- if (delim == -1) {
- // if no protocol is specified, SSH is assumed by git clients
- return SSH;
- }
- String scheme = url.substring(0, delim);
- return fromString(scheme);
- }
- }
-
- public enum TlsClientCertPolicy {
- REQUIRED, TRUE, OPTIONAL, FALSE, DISABLED, NONE;
-
- public static TlsClientCertPolicy fromString(String value) {
- for (TlsClientCertPolicy t : values()) {
- if (t.name().equalsIgnoreCase(value)) {
- switch(t) {
- case TRUE:
- return REQUIRED;
- case FALSE:
- return OPTIONAL;
- case NONE:
- return DISABLED;
- default:
- return t;
- }
- }
- }
- return TlsClientCertPolicy.OPTIONAL;
- }
- }
-
- /**
- * The type of merge Gitblit will use when merging a ticket to the integration branch.
- *
- * The default type is MERGE_ALWAYS.
- *
- * This is modeled after the Gerrit SubmitType.
- */
- public static enum MergeType {
- /** Allows a merge only if it can be fast-forward merged into the integration branch. */
- FAST_FORWARD_ONLY,
- /** Uses a fast-forward merge if possible, other wise a merge commit is created. */
- MERGE_IF_NECESSARY,
- // Future REBASE_IF_NECESSARY,
- /** Always merge with a merge commit, even when a fast-forward would be possible. */
- MERGE_ALWAYS,
- // Future? CHERRY_PICK
- ;
-
- public static final MergeType DEFAULT_MERGE_TYPE = MERGE_ALWAYS;
-
- public static MergeType fromName(String name) {
- for (MergeType type : values()) {
- if (type.name().equalsIgnoreCase(name)) {
- return type;
- }
- }
- return DEFAULT_MERGE_TYPE;
- }
- }
-
-
- @Documented
- @Retention(RetentionPolicy.RUNTIME)
- public @interface Unused {
- }
-}
diff --git a/src/main/java/com/gitblit/FederationClient.java b/src/main/java/com/gitblit/FederationClient.java
deleted file mode 100644
index 64ff01726..000000000
--- a/src/main/java/com/gitblit/FederationClient.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.kohsuke.args4j.CmdLineException;
-import org.kohsuke.args4j.CmdLineParser;
-import org.kohsuke.args4j.Option;
-
-import com.gitblit.manager.FederationManager;
-import com.gitblit.manager.GitblitManager;
-import com.gitblit.manager.IGitblit;
-import com.gitblit.manager.INotificationManager;
-import com.gitblit.manager.RepositoryManager;
-import com.gitblit.manager.RuntimeManager;
-import com.gitblit.manager.UserManager;
-import com.gitblit.models.FederationModel;
-import com.gitblit.models.Mailing;
-import com.gitblit.service.FederationPullService;
-import com.gitblit.utils.FederationUtils;
-import com.gitblit.utils.StringUtils;
-import com.gitblit.utils.XssFilter;
-import com.gitblit.utils.XssFilter.AllowXssFilter;
-
-/**
- * Command-line client to pull federated Gitblit repositories.
- *
- * @author James Moger
- *
- */
-public class FederationClient {
-
- public static void main(String[] args) {
- Params params = new Params();
- CmdLineParser parser = new CmdLineParser(params);
- try {
- parser.parseArgument(args);
- } catch (CmdLineException t) {
- usage(parser, t);
- }
-
- System.out.println("Gitblit Federation Client v" + Constants.getVersion() + " (" + Constants.getBuildDate() + ")");
-
- // command-line specified base folder
- File baseFolder = new File(System.getProperty("user.dir"));
- if (!StringUtils.isEmpty(params.baseFolder)) {
- baseFolder = new File(params.baseFolder);
- }
-
- File regFile = com.gitblit.utils.FileUtils.resolveParameter(Constants.baseFolder$, baseFolder, params.registrationsFile);
- FileSettings settings = new FileSettings(regFile.getAbsolutePath());
- List registrations = new ArrayList();
- if (StringUtils.isEmpty(params.url)) {
- registrations.addAll(FederationUtils.getFederationRegistrations(settings));
- } else {
- if (StringUtils.isEmpty(params.token)) {
- System.out.println("Must specify --token parameter!");
- System.exit(0);
- }
- FederationModel model = new FederationModel("Gitblit");
- model.url = params.url;
- model.token = params.token;
- model.mirror = params.mirror;
- model.bare = params.bare;
- model.folder = "";
- registrations.add(model);
- }
- if (registrations.size() == 0) {
- System.out.println("No Federation Registrations! Nothing to do.");
- System.exit(0);
- }
-
- // command-line specified repositories folder
- if (!StringUtils.isEmpty(params.repositoriesFolder)) {
- settings.overrideSetting(Keys.git.repositoriesFolder, new File(
- params.repositoriesFolder).getAbsolutePath());
- }
-
- // configure the Gitblit singleton for minimal, non-server operation
- XssFilter xssFilter = new AllowXssFilter();
- RuntimeManager runtime = new RuntimeManager(settings, xssFilter, baseFolder).start();
- NoopNotificationManager notifications = new NoopNotificationManager().start();
- UserManager users = new UserManager(runtime, null).start();
- RepositoryManager repositories = new RepositoryManager(runtime, null, users).start();
- FederationManager federation = new FederationManager(runtime, notifications, repositories).start();
- IGitblit gitblit = new GitblitManager(null, null, runtime, null, notifications, users, null, repositories, null, federation, null);
-
- FederationPullService puller = new FederationPullService(gitblit, federation.getFederationRegistrations()) {
- @Override
- public void reschedule(FederationModel registration) {
- // NOOP
- }
- };
- puller.run();
-
- System.out.println("Finished.");
- System.exit(0);
- }
-
- private static void usage(CmdLineParser parser, CmdLineException t) {
- System.out.println(Constants.getGitBlitVersion());
- System.out.println();
- if (t != null) {
- System.out.println(t.getMessage());
- System.out.println();
- }
-
- if (parser != null) {
- parser.printUsage(System.out);
- }
- System.exit(0);
- }
-
- /**
- * Parameters class for FederationClient.
- */
- private static class Params {
-
- @Option(name = "--registrations", usage = "Gitblit Federation Registrations File", metaVar = "FILE")
- public String registrationsFile = "${baseFolder}/federation.properties";
-
- @Option(name = "--url", usage = "URL of Gitblit instance to mirror from", metaVar = "URL")
- public String url;
-
- @Option(name = "--mirror", usage = "Mirror repositories")
- public boolean mirror;
-
- @Option(name = "--bare", usage = "Create bare repositories")
- public boolean bare;
-
- @Option(name = "--token", usage = "Federation Token", metaVar = "TOKEN")
- public String token;
-
- @Option(name = "--baseFolder", usage = "Base folder for received data", metaVar = "PATH")
- public String baseFolder;
-
- @Option(name = "--repositoriesFolder", usage = "Destination folder for cloned repositories", metaVar = "PATH")
- public String repositoriesFolder;
-
- }
-
- private static class NoopNotificationManager implements INotificationManager {
-
- @Override
- public NoopNotificationManager start() {
- return this;
- }
-
- @Override
- public NoopNotificationManager stop() {
- return this;
- }
-
- @Override
- public boolean isSendingMail() {
- return false;
- }
-
- @Override
- public void sendMailToAdministrators(String subject, String message) {
- }
-
- @Override
- public void sendMail(String subject, String message, Collection toAddresses) {
- }
-
- @Override
- public void sendHtmlMail(String subject, String message, Collection toAddresses) {
- }
-
- @Override
- public void send(Mailing mailing) {
- }
- }
-}
diff --git a/src/main/java/com/gitblit/FileSettings.java b/src/main/java/com/gitblit/FileSettings.java
deleted file mode 100644
index 24d86d307..000000000
--- a/src/main/java/com/gitblit/FileSettings.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import com.gitblit.utils.FileUtils;
-import com.gitblit.utils.StringUtils;
-
-/**
- * Dynamically loads and reloads a properties file by keeping track of the last
- * modification date.
- *
- * @author James Moger
- *
- */
-public class FileSettings extends IStoredSettings {
-
- protected File propertiesFile;
-
- private final Properties properties = new Properties();
-
- private volatile long lastModified;
-
- private volatile boolean forceReload;
-
- public FileSettings() {
- super(FileSettings.class);
- }
-
- public FileSettings(String file) {
- this();
- load(file);
- }
-
- public void load(String file) {
- this.propertiesFile = new File(file);
- }
-
- /**
- * Merges the provided settings into this instance. This will also
- * set the target file for this instance IFF it is unset AND the merge
- * source is also a FileSettings. This is a little sneaky.
- */
- @Override
- public void merge(IStoredSettings settings) {
- super.merge(settings);
-
- // sneaky: set the target file from the merge source
- if (propertiesFile == null && settings instanceof FileSettings) {
- this.propertiesFile = ((FileSettings) settings).propertiesFile;
- }
- }
-
- /**
- * Returns a properties object which contains the most recent contents of
- * the properties file.
- */
- @Override
- protected synchronized Properties read() {
- if (propertiesFile != null && propertiesFile.exists() && (forceReload || (propertiesFile.lastModified() > lastModified))) {
- FileInputStream is = null;
- try {
- logger.debug("loading {}", propertiesFile);
- Properties props = new Properties();
- is = new FileInputStream(propertiesFile);
- props.load(is);
-
- // ticket-110
- props = readIncludes(props);
-
- // load properties after we have successfully read file
- properties.clear();
- properties.putAll(props);
- lastModified = propertiesFile.lastModified();
- forceReload = false;
- } catch (FileNotFoundException f) {
- // IGNORE - won't happen because file.exists() check above
- } catch (Throwable t) {
- logger.error("Failed to read " + propertiesFile.getName(), t);
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (Throwable t) {
- // IGNORE
- }
- }
- }
- }
- return properties;
- }
-
- /**
- * Recursively read "include" properties files.
- *
- * @param properties
- * @return
- * @throws IOException
- */
- private Properties readIncludes(Properties properties) throws IOException {
-
- Properties baseProperties = new Properties();
-
- String include = (String) properties.remove("include");
- if (!StringUtils.isEmpty(include)) {
-
- // allow for multiples
- List names = StringUtils.getStringsFromValue(include, ",");
- for (String name : names) {
-
- if (StringUtils.isEmpty(name)) {
- continue;
- }
-
- // try co-located
- File file = new File(propertiesFile.getParentFile(), name.trim());
- if (!file.exists()) {
- // try absolute path
- file = new File(name.trim());
- }
-
- if (!file.exists()) {
- logger.warn("failed to locate {}", file);
- continue;
- }
-
- // load properties
- logger.debug("loading {}", file);
- try (FileInputStream iis = new FileInputStream(file)) {
- baseProperties.load(iis);
- }
-
- // read nested includes
- baseProperties = readIncludes(baseProperties);
-
- }
-
- }
-
- // includes are "default" properties, they must be set first and the
- // props which specified the "includes" must override
- Properties merged = new Properties();
- merged.putAll(baseProperties);
- merged.putAll(properties);
-
- return merged;
- }
-
- @Override
- public boolean saveSettings() {
- String content = FileUtils.readContent(propertiesFile, "\n");
- for (String key : removals) {
- String regex = "(?m)^(" + regExEscape(key) + "\\s*+=\\s*+)"
- + "(?:[^\r\n\\\\]++|\\\\(?:\r?\n|\r|.))*+$";
- content = content.replaceAll(regex, "");
- }
- removals.clear();
-
- FileUtils.writeContent(propertiesFile, content);
- // manually set the forceReload flag because not all JVMs support real
- // millisecond resolution of lastModified. (issue-55)
- forceReload = true;
- return true;
- }
-
- /**
- * Updates the specified settings in the settings file.
- */
- @Override
- public synchronized boolean saveSettings(Map settings) {
- String content = FileUtils.readContent(propertiesFile, "\n");
- for (Map.Entry setting:settings.entrySet()) {
- String regex = "(?m)^(" + regExEscape(setting.getKey()) + "\\s*+=\\s*+)"
- + "(?:[^\r\n\\\\]++|\\\\(?:\r?\n|\r|.))*+$";
- String oldContent = content;
- content = content.replaceAll(regex, setting.getKey() + " = " + setting.getValue());
- if (content.equals(oldContent)) {
- // did not replace value because it does not exist in the file
- // append new setting to content (issue-85)
- content += "\n" + setting.getKey() + " = " + setting.getValue();
- }
- }
- FileUtils.writeContent(propertiesFile, content);
- // manually set the forceReload flag because not all JVMs support real
- // millisecond resolution of lastModified. (issue-55)
- forceReload = true;
- return true;
- }
-
- private String regExEscape(String input) {
- return input.replace(".", "\\.").replace("$", "\\$").replace("{", "\\{");
- }
-
- /**
- * @return the last modification date of the properties file
- */
- protected long lastModified() {
- return lastModified;
- }
-
- /**
- * @return the state of the force reload flag
- */
- protected boolean forceReload() {
- return forceReload;
- }
-
- @Override
- public String toString() {
- if (propertiesFile == null) {
- return "[empty]";
- }
- return propertiesFile.getAbsolutePath();
- }
-}
diff --git a/src/main/java/com/gitblit/GitBlit.java b/src/main/java/com/gitblit/GitBlit.java
deleted file mode 100644
index 4e25d5c6e..000000000
--- a/src/main/java/com/gitblit/GitBlit.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2013 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-import com.gitblit.manager.GitblitManager;
-import com.gitblit.manager.IAuthenticationManager;
-import com.gitblit.manager.IFederationManager;
-import com.gitblit.manager.IFilestoreManager;
-import com.gitblit.manager.INotificationManager;
-import com.gitblit.manager.IPluginManager;
-import com.gitblit.manager.IProjectManager;
-import com.gitblit.manager.IRepositoryManager;
-import com.gitblit.manager.IRuntimeManager;
-import com.gitblit.manager.IUserManager;
-import com.gitblit.tickets.ITicketService;
-import com.gitblit.transport.ssh.IPublicKeyManager;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-
-/**
- * GitBlit is the aggregate manager for the Gitblit webapp. The parent class provides all
- * functionality. This class exists to not break existing Groovy push hooks.
- *
- * @author James Moger
- *
- */
-@Singleton
-@Deprecated
-public class GitBlit extends GitblitManager {
-
- @Inject
- public GitBlit(
- Provider publicKeyManagerProvider,
- Provider ticketServiceProvider,
- IRuntimeManager runtimeManager,
- IPluginManager pluginManager,
- INotificationManager notificationManager,
- IUserManager userManager,
- IAuthenticationManager authenticationManager,
- IRepositoryManager repositoryManager,
- IProjectManager projectManager,
- IFederationManager federationManager,
- IFilestoreManager filestoreManager) {
-
- super(
- publicKeyManagerProvider,
- ticketServiceProvider,
- runtimeManager,
- pluginManager,
- notificationManager,
- userManager,
- authenticationManager,
- repositoryManager,
- projectManager,
- federationManager,
- filestoreManager);
- }
-}
diff --git a/src/main/java/com/gitblit/GitBlitException.java b/src/main/java/com/gitblit/GitBlitException.java
deleted file mode 100644
index 6cf06bcd9..000000000
--- a/src/main/java/com/gitblit/GitBlitException.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-import java.io.IOException;
-
-/**
- * GitBlitException is a marginally useful class. :)
- *
- * @author James Moger
- *
- */
-public class GitBlitException extends IOException {
-
- private static final long serialVersionUID = 1L;
-
- public GitBlitException(String message) {
- super(message);
- }
-
- public GitBlitException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Exception to indicate that the client should prompt for credentials
- * because the requested action requires authentication.
- */
- public static class UnauthorizedException extends GitBlitException {
-
- private static final long serialVersionUID = 1L;
-
- public UnauthorizedException(String message) {
- super(message);
- }
- }
-
- /**
- * Exception to indicate that the requested action can not be executed by
- * the specified user.
- */
- public static class ForbiddenException extends GitBlitException {
-
- private static final long serialVersionUID = 1L;
-
- public ForbiddenException(String message) {
- super(message);
- }
- }
-
- /**
- * Exception to indicate that the requested action has been disabled on the
- * Gitblit server.
- */
- public static class NotAllowedException extends GitBlitException {
-
- private static final long serialVersionUID = 1L;
-
- public NotAllowedException(String message) {
- super(message);
- }
- }
-
- /**
- * Exception to indicate that the requested action can not be executed by
- * the server because it does not recognize the request type.
- */
- public static class UnknownRequestException extends GitBlitException {
-
- private static final long serialVersionUID = 1L;
-
- public UnknownRequestException(String message) {
- super(message);
- }
- }
-}
diff --git a/src/main/java/com/gitblit/GitBlitServer.java b/src/main/java/com/gitblit/GitBlitServer.java
deleted file mode 100644
index d91b3be04..000000000
--- a/src/main/java/com/gitblit/GitBlitServer.java
+++ /dev/null
@@ -1,621 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.URI;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.security.ProtectionDomain;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Properties;
-import java.util.Scanner;
-
-import org.apache.log4j.PropertyConfigurator;
-import org.eclipse.jetty.security.ConstraintMapping;
-import org.eclipse.jetty.security.ConstraintSecurityHandler;
-import org.eclipse.jetty.server.HttpConfiguration;
-import org.eclipse.jetty.server.HttpConnectionFactory;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.server.session.SessionHandler;
-import org.eclipse.jetty.servlet.ListenerHolder;
-import org.eclipse.jetty.util.security.Constraint;
-import org.eclipse.jetty.util.thread.QueuedThreadPool;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.eclipse.jgit.storage.file.FileBasedConfig;
-import org.eclipse.jgit.util.FS;
-import org.eclipse.jgit.util.FileUtils;
-import org.kohsuke.args4j.CmdLineException;
-import org.kohsuke.args4j.CmdLineParser;
-import org.kohsuke.args4j.Option;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.gitblit.Constants.TlsClientCertPolicy;
-import com.gitblit.authority.GitblitAuthority;
-import com.gitblit.authority.NewCertificateConfig;
-import com.gitblit.servlet.GitblitContext;
-import com.gitblit.utils.StringUtils;
-import com.gitblit.utils.TimeUtils;
-import com.gitblit.utils.X509Utils;
-import com.gitblit.utils.X509Utils.X509Log;
-import com.gitblit.utils.X509Utils.X509Metadata;
-import com.unboundid.ldap.listener.InMemoryDirectoryServer;
-import com.unboundid.ldap.listener.InMemoryDirectoryServerConfig;
-import com.unboundid.ldap.listener.InMemoryListenerConfig;
-import com.unboundid.ldif.LDIFReader;
-
-/**
- * GitBlitServer is the embedded Jetty server for Gitblit GO. This class starts
- * and stops an instance of Jetty that is configured from a combination of the
- * gitblit.properties file and command line parameters. JCommander is used to
- * simplify command line parameter processing. This class also automatically
- * generates a self-signed certificate for localhost, if the keystore does not
- * already exist.
- *
- * @author James Moger
- *
- */
-public class GitBlitServer {
-
- private static Logger logger;
-
- public static void main(String... args) {
- GitBlitServer server = new GitBlitServer();
-
- // filter out the baseFolder parameter
- List filtered = new ArrayList();
- String folder = "data";
- for (int i = 0; i < args.length; i++) {
- String arg = args[i];
- if (arg.equals("--baseFolder")) {
- if (i + 1 == args.length) {
- System.out.println("Invalid --baseFolder parameter!");
- System.exit(-1);
- } else if (!".".equals(args[i + 1])) {
- folder = args[i + 1];
- }
- i = i + 1;
- } else {
- filtered.add(arg);
- }
- }
-
- Params.baseFolder = folder;
- Params params = new Params();
- CmdLineParser parser = new CmdLineParser(params);
- try {
- parser.parseArgument(filtered);
- if (params.help) {
- server.usage(parser, null);
- }
- } catch (CmdLineException t) {
- server.usage(parser, t);
- }
-
- if (params.stop) {
- server.stop(params);
- } else {
- server.start(params);
- }
- }
-
- /**
- * Display the command line usage of Gitblit GO.
- *
- * @param parser
- * @param t
- */
- protected final void usage(CmdLineParser parser, CmdLineException t) {
- System.out.println(Constants.BORDER);
- System.out.println(Constants.getGitBlitVersion());
- System.out.println(Constants.BORDER);
- System.out.println();
- if (t != null) {
- System.out.println(t.getMessage());
- System.out.println();
- }
- if (parser != null) {
- parser.printUsage(System.out);
- System.out
- .println("\nExample:\n java -server -Xmx1024M -cp gitblit.jar:ext/* com.gitblit.GitBlitServer --repositoriesFolder /srv/git --httpPort 80 --httpsPort 443");
- }
- System.exit(0);
- }
-
- protected File getBaseFolder(Params params) {
- String path = System.getProperty("GITBLIT_HOME", Params.baseFolder);
- if (!StringUtils.isEmpty(System.getenv("GITBLIT_HOME"))) {
- path = System.getenv("GITBLIT_HOME");
- }
-
- return new File(path).getAbsoluteFile();
- }
-
- /**
- * Stop Gitblt GO.
- */
- public void stop(Params params) {
- try {
- Socket s = new Socket(InetAddress.getByName("127.0.0.1"), params.shutdownPort);
- OutputStream out = s.getOutputStream();
- System.out.println("Sending Shutdown Request to " + Constants.NAME);
- out.write("\r\n".getBytes());
- out.flush();
- s.close();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Start Gitblit GO.
- */
- protected final void start(Params params) {
- final File baseFolder = getBaseFolder(params);
- FileSettings settings = params.FILESETTINGS;
- if (!StringUtils.isEmpty(params.settingsfile)) {
- if (new File(params.settingsfile).exists()) {
- settings = new FileSettings(params.settingsfile);
- }
- }
-
- if (params.dailyLogFile) {
- // Configure log4j for daily log file generation
- InputStream is = null;
- try {
- is = getClass().getResourceAsStream("/log4j.properties");
- Properties loggingProperties = new Properties();
- loggingProperties.load(is);
-
- loggingProperties.put("log4j.appender.R.File", new File(baseFolder, "logs/gitblit.log").getAbsolutePath());
- loggingProperties.put("log4j.rootCategory", "INFO, R");
-
- if (settings.getBoolean(Keys.web.debugMode, false)) {
- loggingProperties.put("log4j.logger.com.gitblit", "DEBUG");
- }
-
- PropertyConfigurator.configure(loggingProperties);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- try {
- if (is != null) {
- is.close();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- logger = LoggerFactory.getLogger(GitBlitServer.class);
- logger.info("\n" + Constants.getASCIIArt());
-
- System.setProperty("java.awt.headless", "true");
-
- String osname = System.getProperty("os.name");
- String osversion = System.getProperty("os.version");
- logger.info("Running on " + osname + " (" + osversion + ")");
-
- String javaversion = System.getProperty("java.version");
- String javavendor = System.getProperty("java.vendor");
- logger.info("JVM version " + javaversion + " (" + javavendor + ")");
-
- QueuedThreadPool threadPool = new QueuedThreadPool();
- int maxThreads = settings.getInteger(Keys.server.threadPoolSize, 50);
- if (maxThreads > 0) {
- threadPool.setMaxThreads(maxThreads);
- }
-
- Server server = new Server(threadPool);
- server.setStopAtShutdown(true);
-
- // conditionally configure the https connector
- if (params.securePort > 0) {
- File certificatesConf = new File(baseFolder, X509Utils.CA_CONFIG);
- File serverKeyStore = new File(baseFolder, X509Utils.SERVER_KEY_STORE);
- File serverTrustStore = new File(baseFolder, X509Utils.SERVER_TRUST_STORE);
- File caRevocationList = new File(baseFolder, X509Utils.CA_REVOCATION_LIST);
-
- // generate CA & web certificates, create certificate stores
- X509Metadata metadata = new X509Metadata("localhost", params.storePassword);
- // set default certificate values from config file
- if (certificatesConf.exists()) {
- FileBasedConfig config = new FileBasedConfig(certificatesConf, FS.detect());
- try {
- config.load();
- } catch (Exception e) {
- logger.error("Error parsing " + certificatesConf, e);
- }
- NewCertificateConfig certificateConfig = NewCertificateConfig.KEY.parse(config);
- certificateConfig.update(metadata);
- }
-
- metadata.notAfter = new Date(System.currentTimeMillis() + 10*TimeUtils.ONEYEAR);
- X509Utils.prepareX509Infrastructure(metadata, baseFolder, new X509Log() {
- @Override
- public void log(String message) {
- BufferedWriter writer = null;
- try {
- writer = new BufferedWriter(new FileWriter(new File(baseFolder, X509Utils.CERTS + File.separator + "log.txt"), true));
- writer.write(MessageFormat.format("{0,date,yyyy-MM-dd HH:mm}: {1}", new Date(), message));
- writer.newLine();
- writer.flush();
- } catch (Exception e) {
- LoggerFactory.getLogger(GitblitAuthority.class).error("Failed to append log entry!", e);
- } finally {
- if (writer != null) {
- try {
- writer.close();
- } catch (IOException e) {
- }
- }
- }
- }
- });
-
- if (serverKeyStore.exists()) {
- /*
- * HTTPS
- */
- logger.info("Setting up HTTPS transport on port " + params.securePort);
- GitblitSslContextFactory factory = new GitblitSslContextFactory(params.alias,
- serverKeyStore, serverTrustStore, params.storePassword, caRevocationList);
- TlsClientCertPolicy clientCertPolicy = TlsClientCertPolicy.fromString(params.requireClientCertificates);
- if (clientCertPolicy == TlsClientCertPolicy.REQUIRED) {
- factory.setNeedClientAuth(true);
- } else if (clientCertPolicy == TlsClientCertPolicy.OPTIONAL) {
- factory.setNeedClientAuth(false);
- factory.setWantClientAuth(true);
- } else {
- factory.setNeedClientAuth(false);
- factory.setWantClientAuth(false);
- }
-
- ServerConnector connector = new ServerConnector(server, factory);
- connector.setIdleTimeout(settings.getLong(Keys.server.httpIdleTimeout, 30000L));
- connector.setPort(params.securePort);
- String bindInterface = settings.getString(Keys.server.httpsBindInterface, null);
- if (!StringUtils.isEmpty(bindInterface)) {
- logger.warn(MessageFormat.format(
- "Binding HTTPS transport on port {0,number,0} to {1}", params.securePort,
- bindInterface));
- connector.setHost(bindInterface);
- }
- if (params.securePort < 1024 && !isWindows()) {
- logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!");
- }
-
- server.addConnector(connector);
- } else {
- logger.warn("Failed to find or load Keystore?");
- logger.warn("HTTPS transport DISABLED.");
- }
- }
-
- // conditionally configure the http transport
- if (params.port > 0) {
- /*
- * HTTP
- */
- logger.info("Setting up HTTP transport on port " + params.port);
-
- HttpConfiguration httpConfig = new HttpConfiguration();
- if (params.port > 0 && params.securePort > 0 && settings.getBoolean(Keys.server.redirectToHttpsPort, true)) {
- httpConfig.setSecureScheme("https");
- httpConfig.setSecurePort(params.securePort);
- }
- httpConfig.setSendServerVersion(false);
- httpConfig.setSendDateHeader(false);
-
- ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(httpConfig));
- connector.setIdleTimeout(settings.getLong(Keys.server.httpIdleTimeout, 30000L));
- connector.setPort(params.port);
- String bindInterface = settings.getString(Keys.server.httpBindInterface, null);
- if (!StringUtils.isEmpty(bindInterface)) {
- logger.warn(MessageFormat.format("Binding HTTP transport on port {0,number,0} to {1}",
- params.port, bindInterface));
- connector.setHost(bindInterface);
- }
- if (params.port < 1024 && !isWindows()) {
- logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!");
- }
-
- server.addConnector(connector);
- }
-
- // tempDir is where the embedded Gitblit web application is expanded and
- // where Jetty creates any necessary temporary files
- File tempDir = com.gitblit.utils.FileUtils.resolveParameter(Constants.baseFolder$, baseFolder, params.temp);
- if (tempDir.exists()) {
- try {
- FileUtils.delete(tempDir, FileUtils.RECURSIVE | FileUtils.RETRY);
- } catch (IOException x) {
- logger.warn("Failed to delete temp dir " + tempDir.getAbsolutePath(), x);
- }
- }
- if (!tempDir.mkdirs()) {
- logger.warn("Failed to create temp dir " + tempDir.getAbsolutePath());
- }
-
- // Get the execution path of this class
- // We use this to set the WAR path.
- ProtectionDomain protectionDomain = GitBlitServer.class.getProtectionDomain();
- URL location = protectionDomain.getCodeSource().getLocation();
-
- // Root WebApp Context
- WebAppContext rootContext = new WebAppContext();
- rootContext.setContextPath(settings.getString(Keys.server.contextPath, "/"));
- rootContext.setServer(server);
- rootContext.setWar(location.toExternalForm());
- rootContext.setTempDirectory(tempDir);
-
-
- // Set cookies HttpOnly so they are not accessible to JavaScript engines
- SessionHandler sessionHandler = rootContext.getSessionHandler();
- sessionHandler.setHttpOnly(true);
- // Use secure cookies if only serving https
- sessionHandler.setSecureRequestOnly( (params.port <= 0 && params.securePort > 0) ||
- (params.port > 0 && params.securePort > 0 && settings.getBoolean(Keys.server.redirectToHttpsPort, true)) );
-
- // Ensure there is a defined User Service
- String realmUsers = params.userService;
- if (StringUtils.isEmpty(realmUsers)) {
- logger.error(MessageFormat.format("PLEASE SPECIFY {0}!!", Keys.realm.userService));
- return;
- }
-
- // Override settings from the command-line
- settings.overrideSetting(Keys.realm.userService, params.userService);
- settings.overrideSetting(Keys.git.repositoriesFolder, params.repositoriesFolder);
- settings.overrideSetting(Keys.git.daemonPort, params.gitPort);
- settings.overrideSetting(Keys.git.sshPort, params.sshPort);
-
- // Start up an in-memory LDAP server, if configured
- try {
- if (!StringUtils.isEmpty(params.ldapLdifFile)) {
- File ldifFile = new File(params.ldapLdifFile);
- if (ldifFile != null && ldifFile.exists()) {
- URI ldapUrl = new URI(settings.getRequiredString(Keys.realm.ldap.server));
- String firstLine = new Scanner(ldifFile).nextLine();
- String rootDN = firstLine.substring(4);
- String bindUserName = settings.getString(Keys.realm.ldap.username, "");
- String bindPassword = settings.getString(Keys.realm.ldap.password, "");
-
- // Get the port
- int port = ldapUrl.getPort();
- if (port == -1)
- port = 389;
-
- InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(rootDN);
- config.addAdditionalBindCredentials(bindUserName, bindPassword);
- config.setListenerConfigs(InMemoryListenerConfig.createLDAPConfig("default", port));
- config.setSchema(null);
-
- InMemoryDirectoryServer ds = new InMemoryDirectoryServer(config);
- ds.importFromLDIF(true, new LDIFReader(ldifFile));
- ds.startListening();
-
- logger.info("LDAP Server started at ldap://localhost:" + port);
- }
- }
- } catch (Exception e) {
- // Completely optional, just show a warning
- logger.warn("Unable to start LDAP server", e);
- }
-
- // Set the server's contexts
- server.setHandler(rootContext);
-
- // redirect HTTP requests to HTTPS
- if (params.port > 0 && params.securePort > 0 && settings.getBoolean(Keys.server.redirectToHttpsPort, true)) {
- logger.info(String.format("Configuring automatic http(%1$s) -> https(%2$s) redirects", params.port, params.securePort));
- // Create the internal mechanisms to handle secure connections and redirects
- Constraint constraint = new Constraint();
- constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL);
-
- ConstraintMapping cm = new ConstraintMapping();
- cm.setConstraint(constraint);
- cm.setPathSpec("/*");
-
- ConstraintSecurityHandler sh = new ConstraintSecurityHandler();
- sh.setConstraintMappings(new ConstraintMapping[] { cm });
-
- // Configure this context to use the Security Handler defined before
- rootContext.setSecurityHandler(sh);
- }
-
- // Setup the Gitblit context
- ListenerHolder gitblitHolder = new ListenerHolder(GitblitContext.class);
- gitblitHolder.setListener(newGitblit(settings, baseFolder));
- rootContext.getServletHandler().addListener(gitblitHolder);
-
- try {
- // start the shutdown monitor
- if (params.shutdownPort > 0) {
- Thread shutdownMonitor = new ShutdownMonitorThread(server, params);
- shutdownMonitor.start();
- }
-
- // start Jetty
- server.start();
- server.join();
- } catch (Exception e) {
- e.printStackTrace();
- System.exit(100);
- }
- }
-
- protected GitblitContext newGitblit(IStoredSettings settings, File baseFolder) {
- return new GitblitContext(settings, baseFolder);
- }
-
- /**
- * Tests to see if the operating system is Windows.
- *
- * @return true if this is a windows machine
- */
- private boolean isWindows() {
- return System.getProperty("os.name").toLowerCase().indexOf("windows") > -1;
- }
-
- /**
- * The ShutdownMonitorThread opens a socket on a specified port and waits
- * for an incoming connection. When that connection is accepted a shutdown
- * message is issued to the running Jetty server.
- *
- * @author James Moger
- *
- */
- private static class ShutdownMonitorThread extends Thread {
-
- private final ServerSocket socket;
-
- private final Server server;
-
- private final Logger logger = LoggerFactory.getLogger(ShutdownMonitorThread.class);
-
- public ShutdownMonitorThread(Server server, Params params) {
- this.server = server;
- setDaemon(true);
- setName(Constants.NAME + " Shutdown Monitor");
- ServerSocket skt = null;
- try {
- skt = new ServerSocket(params.shutdownPort, 1, InetAddress.getByName("127.0.0.1"));
- } catch (Exception e) {
- logger.warn("Could not open shutdown monitor on port " + params.shutdownPort, e);
- }
- socket = skt;
- }
-
- @Override
- public void run() {
- // Only run if the socket was able to be created (not already in use, failed to bind, etc.)
- if (null != socket) {
- logger.info("Shutdown Monitor listening on port " + socket.getLocalPort());
- Socket accept;
- try {
- accept = socket.accept();
- BufferedReader reader = new BufferedReader(new InputStreamReader(
- accept.getInputStream()));
- reader.readLine();
- logger.info(Constants.BORDER);
- logger.info("Stopping " + Constants.NAME);
- logger.info(Constants.BORDER);
- server.stop();
- server.setStopAtShutdown(false);
- accept.close();
- socket.close();
- } catch (Exception e) {
- logger.warn("Failed to shutdown Jetty", e);
- }
- }
- }
- }
-
- /**
- * Parameters class for GitBlitServer.
- */
- public static class Params {
-
- public static String baseFolder;
-
- private final FileSettings FILESETTINGS = new FileSettings(new File(baseFolder, Constants.PROPERTIES_FILE).getAbsolutePath());
-
- /*
- * Server parameters
- */
- @Option(name = "--help", aliases = { "-h"}, usage = "Show this help")
- public Boolean help = false;
-
- @Option(name = "--stop", usage = "Stop Server")
- public Boolean stop = false;
-
- @Option(name = "--tempFolder", usage = "Folder for server to extract built-in webapp", metaVar="PATH")
- public String temp = FILESETTINGS.getString(Keys.server.tempFolder, "temp");
-
- @Option(name = "--dailyLogFile", usage = "Log to a rolling daily log file INSTEAD of stdout.")
- public Boolean dailyLogFile = false;
-
- /*
- * GIT Servlet Parameters
- */
- @Option(name = "--repositoriesFolder", usage = "Git Repositories Folder", metaVar="PATH")
- public String repositoriesFolder = FILESETTINGS.getString(Keys.git.repositoriesFolder,
- "git");
-
- /*
- * Authentication Parameters
- */
- @Option(name = "--userService", usage = "Authentication and Authorization Service (filename or fully qualified classname)")
- public String userService = FILESETTINGS.getString(Keys.realm.userService,
- "users.conf");
-
- /*
- * JETTY Parameters
- */
- @Option(name = "--httpPort", usage = "HTTP port for to serve. (port <= 0 will disable this connector)", metaVar="PORT")
- public Integer port = FILESETTINGS.getInteger(Keys.server.httpPort, 0);
-
- @Option(name = "--httpsPort", usage = "HTTPS port to serve. (port <= 0 will disable this connector)", metaVar="PORT")
- public Integer securePort = FILESETTINGS.getInteger(Keys.server.httpsPort, 8443);
-
- @Option(name = "--gitPort", usage = "Git Daemon port to serve. (port <= 0 will disable this connector)", metaVar="PORT")
- public Integer gitPort = FILESETTINGS.getInteger(Keys.git.daemonPort, 9418);
-
- @Option(name = "--sshPort", usage = "Git SSH port to serve. (port <= 0 will disable this connector)", metaVar = "PORT")
- public Integer sshPort = FILESETTINGS.getInteger(Keys.git.sshPort, 29418);
-
- @Option(name = "--alias", usage = "Alias of SSL certificate in keystore for serving https.", metaVar="ALIAS")
- public String alias = FILESETTINGS.getString(Keys.server.certificateAlias, "");
-
- @Option(name = "--storePassword", usage = "Password for SSL (https) keystore.", metaVar="PASSWORD")
- public String storePassword = FILESETTINGS.getString(Keys.server.storePassword, "");
-
- @Option(name = "--shutdownPort", usage = "Port for Shutdown Monitor to listen on. (port <= 0 will disable this monitor)", metaVar="PORT")
- public Integer shutdownPort = FILESETTINGS.getInteger(Keys.server.shutdownPort, 8081);
-
- @Option(name = "--requireClientCertificates", usage = "Require client X509 certificates for https connections.")
- public String requireClientCertificates = FILESETTINGS.getString(Keys.server.requireClientCertificates, "optional");
-
- /*
- * Setting overrides
- */
- @Option(name = "--settings", usage = "Path to alternative settings", metaVar="FILE")
- public String settingsfile;
-
- @Option(name = "--ldapLdifFile", usage = "Path to LDIF file. This will cause an in-memory LDAP server to be started according to gitblit settings", metaVar="FILE")
- public String ldapLdifFile;
-
- }
-}
diff --git a/src/main/java/com/gitblit/GitblitSslContextFactory.java b/src/main/java/com/gitblit/GitblitSslContextFactory.java
deleted file mode 100644
index bda92afa4..000000000
--- a/src/main/java/com/gitblit/GitblitSslContextFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2012 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-import java.io.File;
-import java.security.KeyStore;
-import java.security.cert.CRL;
-import java.util.Collection;
-
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.gitblit.utils.StringUtils;
-
-/**
- * Special SSL context factory that configures Gitblit GO and replaces the
- * primary trustmanager with a GitblitTrustManager.
- *
- * @author James Moger
- */
-public class GitblitSslContextFactory extends SslContextFactory {
-
- private static final Logger logger = LoggerFactory.getLogger(GitblitSslContextFactory.class);
-
- private final File caRevocationList;
-
- public GitblitSslContextFactory(String certAlias, File keyStore, File clientTrustStore,
- String storePassword, File caRevocationList) {
- super(keyStore.getAbsolutePath());
-
- this.caRevocationList = caRevocationList;
-
- if (!StringUtils.isEmpty(certAlias)) {
- logger.info(" certificate alias = " + certAlias);
- setCertAlias(certAlias);
- }
- setKeyStorePassword(storePassword);
- setTrustStorePath(clientTrustStore.getAbsolutePath());
- setTrustStorePassword(storePassword);
- addExcludeProtocols("SSLv3");
-
- logger.info(" keyStorePath = " + keyStore.getAbsolutePath());
- logger.info(" trustStorePath = " + clientTrustStore.getAbsolutePath());
- logger.info(" crlPath = " + caRevocationList.getAbsolutePath());
- }
-
- @Override
- protected TrustManager[] getTrustManagers(KeyStore trustStore, Collection extends CRL> crls)
- throws Exception {
- TrustManager[] managers = super.getTrustManagers(trustStore, crls);
- X509TrustManager delegate = (X509TrustManager) managers[0];
- GitblitTrustManager root = new GitblitTrustManager(delegate, caRevocationList);
-
- // replace first manager with the GitblitTrustManager
- managers[0] = root;
- return managers;
- }
-}
diff --git a/src/main/java/com/gitblit/GitblitTrustManager.java b/src/main/java/com/gitblit/GitblitTrustManager.java
deleted file mode 100644
index 728a9b101..000000000
--- a/src/main/java/com/gitblit/GitblitTrustManager.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright 2012 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509CRL;
-import java.security.cert.X509CRLEntry;
-import java.security.cert.X509Certificate;
-import java.text.MessageFormat;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.net.ssl.X509TrustManager;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * GitblitTrustManager is a wrapper trust manager that hot-reloads a local file
- * CRL and enforces client certificate revocations. The GitblitTrustManager
- * also implements fuzzy revocation enforcement in case of issuer mismatch BUT
- * serial number match. These rejecions are specially noted in the log.
- *
- * @author James Moger
- */
-public class GitblitTrustManager implements X509TrustManager {
-
- private static final Logger logger = LoggerFactory.getLogger(GitblitTrustManager.class);
-
- private final X509TrustManager delegate;
- private final File caRevocationList;
-
- private final AtomicLong lastModified = new AtomicLong(0);
- private volatile X509CRL crl;
-
- public GitblitTrustManager(X509TrustManager delegate, File crlFile) {
- this.delegate = delegate;
- this.caRevocationList = crlFile;
- }
-
- @Override
- public void checkClientTrusted(X509Certificate[] chain, String authType)
- throws CertificateException {
- X509Certificate cert = chain[0];
- if (isRevoked(cert)) {
- String message = MessageFormat.format("Rejecting revoked certificate {0,number,0} for {1}",
- cert.getSerialNumber(), cert.getSubjectDN().getName());
- logger.warn(message);
- throw new CertificateException(message);
- }
- delegate.checkClientTrusted(chain, authType);
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] chain, String authType)
- throws CertificateException {
- delegate.checkServerTrusted(chain, authType);
- }
-
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return delegate.getAcceptedIssuers();
- }
-
- protected boolean isRevoked(X509Certificate cert) {
- if (!caRevocationList.exists()) {
- return false;
- }
- read();
-
- if (crl.isRevoked(cert)) {
- // exact cert is revoked
- return true;
- }
-
- X509CRLEntry entry = crl.getRevokedCertificate(cert.getSerialNumber());
- if (entry != null) {
- logger.warn("Certificate issuer does not match CRL issuer, but serial number has been revoked!");
- logger.warn(" cert issuer = " + cert.getIssuerX500Principal());
- logger.warn(" crl issuer = " + crl.getIssuerX500Principal());
- return true;
- }
-
- return false;
- }
-
- protected synchronized void read() {
- if (lastModified.get() == caRevocationList.lastModified()) {
- return;
- }
- logger.info("Reloading CRL from " + caRevocationList.getAbsolutePath());
- InputStream inStream = null;
- try {
- inStream = new FileInputStream(caRevocationList);
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- X509CRL list = (X509CRL)cf.generateCRL(inStream);
- crl = list;
- lastModified.set(caRevocationList.lastModified());
- } catch (Exception e) {
- } finally {
- if (inStream != null) {
- try {
- inStream.close();
- } catch (Exception e) {
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/gitblit/GravatarGenerator.java b/src/main/java/com/gitblit/GravatarGenerator.java
deleted file mode 100644
index 1ba02e55a..000000000
--- a/src/main/java/com/gitblit/GravatarGenerator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2015 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-import com.gitblit.utils.ActivityUtils;
-import com.google.inject.Singleton;
-
-@Singleton
-public class GravatarGenerator implements AvatarGenerator {
-
- @Override
- public String getURL(String username, String emailaddress, boolean identicon, int width) {
- String email = emailaddress == null ? username : emailaddress;
- if (identicon) {
- return ActivityUtils.getGravatarIdenticonUrl(email, width);
- } else {
- return ActivityUtils.getGravatarThumbnailUrl(email, width);
- }
- }
-
-}
diff --git a/src/main/java/com/gitblit/IStoredSettings.java b/src/main/java/com/gitblit/IStoredSettings.java
deleted file mode 100644
index 6d99832ea..000000000
--- a/src/main/java/com/gitblit/IStoredSettings.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * Copyright 2011 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.gitblit.utils.StringUtils;
-
-/**
- * Base class for stored settings implementations.
- *
- * @author James Moger
- *
- */
-public abstract class IStoredSettings {
-
- protected final Logger logger;
-
- protected final Properties overrides = new Properties();
-
- protected final Set removals = new TreeSet();
-
- public IStoredSettings(Class extends IStoredSettings> clazz) {
- logger = LoggerFactory.getLogger(clazz);
- }
-
- protected abstract Properties read();
-
- private Properties getSettings() {
- Properties props = read();
- props.putAll(overrides);
- return props;
- }
-
- /**
- * Returns the list of keys whose name starts with the specified prefix. If
- * the prefix is null or empty, all key names are returned.
- *
- * @param startingWith
- * @return list of keys
- */
- public List getAllKeys(String startingWith) {
- List keys = new ArrayList();
- Properties props = getSettings();
- if (StringUtils.isEmpty(startingWith)) {
- keys.addAll(props.stringPropertyNames());
- } else {
- startingWith = startingWith.toLowerCase();
- for (Object o : props.keySet()) {
- String key = o.toString();
- if (key.toLowerCase().startsWith(startingWith)) {
- keys.add(key);
- }
- }
- }
- return keys;
- }
-
- /**
- * Returns the boolean value for the specified key. If the key does not
- * exist or the value for the key can not be interpreted as a boolean, the
- * defaultValue is returned.
- *
- * @param key
- * @param defaultValue
- * @return key value or defaultValue
- */
- public boolean getBoolean(String name, boolean defaultValue) {
- Properties props = getSettings();
- if (props.containsKey(name)) {
- String value = props.getProperty(name);
- if (!StringUtils.isEmpty(value)) {
- return Boolean.parseBoolean(value.trim());
- }
- }
- return defaultValue;
- }
-
- /**
- * Returns the integer value for the specified key. If the key does not
- * exist or the value for the key can not be interpreted as an integer, the
- * defaultValue is returned.
- *
- * @param key
- * @param defaultValue
- * @return key value or defaultValue
- */
- public int getInteger(String name, int defaultValue) {
- Properties props = getSettings();
- if (props.containsKey(name)) {
- try {
- String value = props.getProperty(name);
- if (!StringUtils.isEmpty(value)) {
- return Integer.parseInt(value.trim());
- }
- } catch (NumberFormatException e) {
- logger.warn("Failed to parse integer for " + name + " using default of "
- + defaultValue);
- }
- }
- return defaultValue;
- }
-
- /**
- * Returns the long value for the specified key. If the key does not
- * exist or the value for the key can not be interpreted as an long, the
- * defaultValue is returned.
- *
- * @param key
- * @param defaultValue
- * @return key value or defaultValue
- */
- public long getLong(String name, long defaultValue) {
- Properties props = getSettings();
- if (props.containsKey(name)) {
- try {
- String value = props.getProperty(name);
- if (!StringUtils.isEmpty(value)) {
- return Long.parseLong(value.trim());
- }
- } catch (NumberFormatException e) {
- logger.warn("Failed to parse long for " + name + " using default of "
- + defaultValue);
- }
- }
- return defaultValue;
- }
-
- /**
- * Returns an int filesize from a string value such as 50m or 50mb
- * @param name
- * @param defaultValue
- * @return an int filesize or defaultValue if the key does not exist or can
- * not be parsed
- */
- public int getFilesize(String name, int defaultValue) {
- String val = getString(name, null);
- if (StringUtils.isEmpty(val)) {
- return defaultValue;
- }
- return com.gitblit.utils.FileUtils.convertSizeToInt(val, defaultValue);
- }
-
- /**
- * Returns an long filesize from a string value such as 50m or 50mb
- * @param n
- * @param defaultValue
- * @return a long filesize or defaultValue if the key does not exist or can
- * not be parsed
- */
- public long getFilesize(String key, long defaultValue) {
- String val = getString(key, null);
- if (StringUtils.isEmpty(val)) {
- return defaultValue;
- }
- return com.gitblit.utils.FileUtils.convertSizeToLong(val, defaultValue);
- }
-
- /**
- * Returns the char value for the specified key. If the key does not exist
- * or the value for the key can not be interpreted as a char, the
- * defaultValue is returned.
- *
- * @param key
- * @param defaultValue
- * @return key value or defaultValue
- */
- public char getChar(String name, char defaultValue) {
- Properties props = getSettings();
- if (props.containsKey(name)) {
- String value = props.getProperty(name);
- if (!StringUtils.isEmpty(value)) {
- return value.trim().charAt(0);
- }
- }
- return defaultValue;
- }
-
- /**
- * Returns the string value for the specified key. If the key does not exist
- * or the value for the key can not be interpreted as a string, the
- * defaultValue is returned.
- *
- * @param key
- * @param defaultValue
- * @return key value or defaultValue
- */
- public String getString(String name, String defaultValue) {
- Properties props = getSettings();
- if (props.containsKey(name)) {
- String value = props.getProperty(name);
- if (value != null) {
- return value.trim();
- }
- }
- return defaultValue;
- }
-
- /**
- * Returns the string value for the specified key. If the key does not
- * exist an exception is thrown.
- *
- * @param key
- * @return key value
- */
- public String getRequiredString(String name) {
- Properties props = getSettings();
- if (props.containsKey(name)) {
- String value = props.getProperty(name);
- if (value != null) {
- return value.trim();
- }
- }
- throw new RuntimeException("Property (" + name + ") does not exist");
- }
-
- /**
- * Returns a list of space-separated strings from the specified key.
- *
- * @param name
- * @return list of strings
- */
- public List getStrings(String name) {
- return getStrings(name, " ");
- }
-
- /**
- * Returns a list of strings from the specified key using the specified
- * string separator.
- *
- * @param name
- * @param separator
- * @return list of strings
- */
- public List getStrings(String name, String separator) {
- List strings = new ArrayList();
- Properties props = getSettings();
- if (props.containsKey(name)) {
- String value = props.getProperty(name);
- strings = StringUtils.getStringsFromValue(value, separator);
- }
- return strings;
- }
-
- /**
- * Returns a list of space-separated integers from the specified key.
- *
- * @param name
- * @return list of strings
- */
- public List getIntegers(String name) {
- return getIntegers(name, " ");
- }
-
- /**
- * Returns a list of integers from the specified key using the specified
- * string separator.
- *
- * @param name
- * @param separator
- * @return list of integers
- */
- public List getIntegers(String name, String separator) {
- List