Installing Git Fusion using OS-Specific Packages

Who is this for? Operating system-specific packages provide a simplified way to install Git Fusion and its dependences on a supported platform.

We provide the following packages:

  • RPM packages for CentOS/Red Hat.

  • Debian packages for Ubuntu.

Prerequisites

Note

See the Git Fusion release notes for the most comprehensive and recent software and hardware requirements.

  • Requirements for the Git Fusion server

    • Linux Intel x86_64

      • Ubuntu 12.04 LTS

      • Ubuntu 14.04 LTS

      • CentOS or Red Hat 6.x

      • CentOS or Red Hat 7.x not recommended: http setup too difficult

    • For production use, we recommend at least 4 cores and 16 GB memory.

    • You must have root level access to the server that hosts Git Fusion.

    • Internet connection.

  • Requirements for the Perforce service

    • See the Git Fusion release notes for current Perforce Server (P4D) version requirements.

    • You must have root level access to the server(s) that host(s) your Perforce service, as well as Perforce super user access.

    • Python 2.6+, 3.2+, or 3.3+ on the server hosting the Perforce service triggers.

Installation steps

Note

On CentOS/Red Hat, default SELinux security policies may deny Git Fusion packages access to resources that they need to install. If your organization's security policy permits it, disabling SELinux may help to simplify installation. If you require SELinux, contact Perforce customer support for assistance.

  1. Import the Perforce package signing key.

    As root (or a user with sudo privileges), run one of the following:

    For RPM:

    # rpm --import http://package.perforce.com/perforce.pubkey

    For Debian:

    $ wget -q http://package.perforce.com/perforce.pubkey -O- | sudo apt-key add -

    For information about how to verify the authenticity of the signing key, see http://answers.perforce.com/articles/KB_Article/Public-Key-for-Installation-Packages.

  2. Add the Perforce package repository.

    • For RPM packages, create a file called /etc/yum.repos.d/perforce.repo with the following content:

      [perforce]
      name=Perforce
      baseurl=http://package.perforce.com/yum/rhel/{version}/x86_64/
      enabled=1
      gpgcheck=1

      Note

      Replace {version} with the major version of your distribution, either '6' or '7'. CentOS and Red Hat 7.x. not recommended: http setup too difficult.

    • For the Debian package, create a file called /etc/apt/sources.list.d/perforce.list with the following line:

      deb http://package.perforce.com/apt/ubuntu {version} release

      Note

      Replace {version} with the codename of your distribution, either 'precise' (Ubuntu 12.04) or 'trusty' (Ubuntu 14.04).

      Update the package repository:

      $ sudo apt-get update
  3. Install the Git Fusion package.

    There are two package files to choose from:

    • helix-git-fusion: installs the most recent stable version of Git Fusion and creates a Git Fusion service account named git. This is the Unix account that Git users will use when they run a Git command against Git Fusion using SSH. It is also the account that administrators will use to run Git Fusion utility scripts. The package will create the account with home directory in /opt/perforce/git-fusion/home/perforce-git-fusion.

      After installation, you should immediately set a strong password for this new git user. Your SSH users will use SSH keys for access, and so they will not need to know this password.

      For CentOS and Red Hat, run:

      # yum install helix-git-fusion
      # passwd git

      For Ubuntu, run:

      $ sudo apt-get install helix-git-fusion
      $ sudo passwd git
    • helix-git-fusion-base: installs the most recent stable version of Git Fusion and does not create a git user.

      This package enables you to configure a Git Fusion service account with whatever name you want when you run the configure-git-fusion.sh script (in the next step).

      For CentOS and Red Hat, run:

      # yum install helix-git-fusion-base

      For Ubuntu, run:

      $ sudo apt-get install helix-git-fusion-base

    The packages install Git Fusion and its dependencies under /opt/perforce/git-fusion to prevent conflicts with any system versions of Git and Python.

  4. Run the configure-git-fusion.sh script.

    # /opt/perforce/git-fusion/libexec/configure-git-fusion.sh

    The script prompts you for the following:

    • Whether you want to connect to an existing Perforce service or create a new one.

      Enter new to install and configure a new Perforce service on the machine that hosts Git Fusion.

      Enter local to connect to a Perforce service existing on the same machine hosting Git Fusion.

      Enter remote to connect to a Perforce service existing on another machine.

    • How you want to handle the Perforce change owner for git commits authored by non-Perforce users.

      Enter reject to reject push which contains commits authored by non-Perforce users (default)

      Enter pusher to accept commits authored by non-Perforce users and set the change owner to the pusher

      Enter unknown to accept commits authored by non-Perforce users and set the change owner to 'unknown_git'. This option will also create 'unknown_git' Perforce user.

      Note

      Note: The actual pusher, author, and committer are always recorded in the Perforce changelist description.

    • Perforce service's hostname and port (P4PORT).

    • Perforce super user name and password to enable Git Fusion to run administrative p4 commands.

    • If the script is creating a new Perforce service, the path to your preferred location for the Perforce Server root directory.

    • Git Fusion time zone, in Olson format.

      Set it to your Perforce service time zone or accept the default, which is the Git Fusion host machine's time zone.

      Git Fusion uses the Olson time zone format, as recognized by pytz (for example, US/Pacific rather than PST).

    • Whether you want to configure HTTPS authentication

      Enter yes if you installed the helix-git-fusion package and satisfy the requirements for HTTPS configuration.

      Enter no if you do not wish to use HTTPS authentication, installed helix-git-fusion-base package, or do not satisfy any of the requirements for HTTPS configuration.

      Note

      See Authenticating Git users and Git Fusion release notes for HTTPS configuration requirements.

    • If you installed Git Fusion using the helix-git-fusion-base package, the name and password of the system account that will run Git commands for Git Fusion (git, by default).

      If you installed Git Fusion using the helix-git-fusion package, which creates the Git Fusion service account git, the script configures that user without prompting you.

    • Single password to be shared by any new Perforce users that Git Fusion creates to enable it to interact with the Perforce service.

      The first time you install and configure a Git Fusion instance for use with any given Perforce service, the script creates the users git-fusion-user, git-fusion-reviews-server-id, git-fusion-reviews--non-gf, and git-fusion-reviews--all-gf.

      Note

      You can set individual passwords after the configuration script is finished by issuing the following command:

      $ p4 -p myperforceserver:port -C charset -u user_name passwd

    When the script is finished, it congratulates you and suggests that you configure your Perforce service to use Git Fusion's atomic push triggers.

    For detailed information about the functions performed by the configuration script, along with information about rerunning it to change your initial configuration settings, see configure-git-fusion.sh in the Script Reference.

  5. Configure Git Fusion triggers in the Perforce service to support atomic pushes.

    Important

    We recommend that any submit triggers running on your Perforce service exclude changes that are submitted by git-fusion-user. These include change-submit, change-commit,and change-content triggers that enforce a local policy, like requiring jobs, specific content, or specific formatting in the changelist description. Such triggers can interrupt Git Fusion in the middle of a push, which will damage the repository as replicated within Perforce.

    If you cannot exclude git-fusion-user from these triggers, you can instead create preflight hooks that reject git pushes based on local policies derived from your current submit triggers. For more information, see Adding preflight commits to reject pushes.

    1. Copy the p4gf_submit_trigger.py script and the high performance wrapper p4gf_submit_trigger_wrapper.sh from /opt/perforce/git-fusion/libexec to the server hosting the Perforce service.

      Note

      The wrapper script is written in Bash, which has a much lower startup overhead than Python. The wrapper quickly determines if the triggered event is related to a Git Fusion operation, in which case a call to the Python script is avoided entirely. Although the Python script can also be called directly, this arrangement improves Git Fusion performance.

      Note

      If your Perforce service and Git Fusion are hosted on the same server, you don't need to copy the scripts.

      Note

      If your Perforce service is hosted on a platform supported by Git Fusion packages, you can install the helix-git-fusion-trigger package on it to satisfy this step.

    2. Log in to the server hosting the Perforce service as a user with sudo privileges.

    3. Run the p4gf_submit_trigger.py script to install and configure the triggers.

      $ p4gf_submit_trigger.py --install  myperforceserver:port perforce_super_user password 

      The script does the following:

      • Creates login tickets for the Perforce users git-fusion-user, git-fusion-reviews-server-id, git-fusion-reviews--non-gf, and git-fusion-reviews--all-gf.

      • Creates a trigger configuration file, p4gf_submit_trigger.cfg, in the same directory as the trigger script, that holds your P4PORT and P4CHARSET variables, as well as the path to the P4 binary.

      • Adds Git Fusion trigger entries to the Perforce Triggers table. If the high performance Bash wrapper is present, triggers will be configured to call it, otherwise they will be configured to call the Python script directly.

      • If your Perforce service is SSL-enabled, generates the p4gf_submit_trigger.trust file in the same directory as the trigger script to manage the trust of the SSL connection.

      • Sets the p4 key that verifies that the trigger was installed.

      If you are upgrading an existing Git Fusion installation, the script replaces your old Git Fusion triggers with new ones. It does not touch any other triggers.

    For more details about p4gf_submit_trigger.py, see the Script Reference.

    For more information about triggers, see the Perforce System Administrator's Guide, "Scripting Perforce: Triggers and Daemons."

  6. Verify the configuration from the Git Fusion server.

    Switch to the Git Fusion service account (git) on the Git Fusion server and run p4gf_super_init.py.

    # su - git
    $ p4gf_super_init.py --user perforce_super_user

    The script should report that everything has been created, already exists, or is up to date.

Next steps

You are now ready to: