GitBlit

From Knowledge
Jump to: navigation, search

Ce tutoriel explique l'installation de GitBlit sur un serveur GNU/Linux Debian (mode CLI).

Conditions requises

GitBlit est un logiciel Java, il nécessite par conséquent l'installation de l'environnement d'exécution (Runtime Environment) de Java (JRE). L'installation de la JRE sous Debian fait l'objet d'un tutoriel dédié.

Installation

  • Créer utilisateur gitblit
useradd -c "GitBlit" -m -s /bin/bash gitblit
  • Créer le répertoire /opt/gitblit
  • Déposer le fichier téléchargé dans dossier /opt/gitblit
  • Décompresser gitblit-<version>.tar.gz
7z x gitblit-<version>.tar.gz
  • Décompresser gitblit-<version>.tar
7z x gitblit-<version>.tar
  • Changer le propriétaire et groupe du répertoire /opt/gitblit et de ses sous-répertoires
chown -R gitblit:gitblit /opt/gitblit
  • Changer les privilèges du répertoire /opt/gitblit et de ses sous-répertoires à 775
chmod -R 775 /opt/gitblit
  • Modifier le fichier de configuration GitBlit /opt/gitblit/data/gitblit.properties comme suit:
#
# 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
#
# 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 = 0

# 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 = true

# 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 = 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 = VIEW

# 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. The the manual
# page for 'git init' for more information on shared repositories.
#
# SINCE 1.4.0
git.createRepositoriesShared = true

# 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 = 20m

# The HTTP proxy host for plugin manager.
#
# SINCE 1.7.0
plugins.httpProxyHost = http://proxy-bvcol.admin.ch:8080

# The HTTP proxy port for plugin manager.
#
# SINCE 1.7.0
plugins.httpProxyPort = 8080

# Require authentication to see everything but the admin pages
#
# SINCE 0.5.0
# RESTART REQUIRED
#web.authenticateViewPages = false
web.authenticateViewPages = true

# 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

# Setting to include personal repositories in the main repositories list.
#
# SINCE 1.6.0
web.includePersonalRepositories = true

# 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 = false

# Allow Gravatar images to be displayed in Gitblit pages.
#
# SINCE 0.8.0
web.allowGravatar = false

# Use Clippy (Flash solution) to provide a copy-to-clipboard button.
# 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 = false

# 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 = Europe/Zurich

# 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 = dd-MM-yyyy

# Long date format
#
# SINCE 0.8.0
web.datestampLongFormat = EEEE, d MMMM yyyy

# Long timestamp format
# <http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html>
#
# SINCE 0.5.0
web.datetimestampLongFormat = EEEE d MMMM yyyy HH:mm Z

# 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

# Defines the default commit message renderer.  This can be configured
# per-repository.
#
# Valid values are: plain, markdown
#
# SINCE 1.4.0
web.commitMessageRenderer = markdown

# Show a README file, if available, on the summary page.
#
# SINCE 1.4.0
web.summaryShowReadme = true	
  • Créer un lien symbolique /etc/init.d/gitblit qui pointe sur /opt/gitblit/service-ubuntu.sh
ln -s /opt/gitblit/service-ubuntu.sh /etc/init.d/gitblit
  • Enregistrer GitBlit en tant que service à démarrer automatiquement
update-rc.d gitblit defaults
  • C'est installé, vous pouvez maintenant démarrer le serveur GitBlit...
/etc/init.d/gitblit start
  • ...et vous connecter à la console d'administration (login par défaut: admin/admin)