Gitfence

GitHub Enterprise Server

Run self-hosted Gitfence against GitHub Enterprise Server 3.9 or later: two settings and your own GitHub App on your server.

Short answer: Self-hosted Gitfence works with GitHub Enterprise Server 3.9 or later. Set two addresses, create the Gitfence GitHub App on your server with one command, and everything (sign-in, clones, pull requests, reviews and webhooks) goes to your GitHub Enterprise Server instead of github.com. Our hosted service works with github.com, including GitHub Enterprise Cloud.

What you need

  • Self-hosted Gitfence.
  • GitHub Enterprise Server 3.9 or later, with its REST API.
  • Outbound HTTPS from Gitfence to your GitHub Enterprise Server. Inbound HTTPS for webhooks is best, but not required.
  • An owner of the GitHub organization where the App will live.

Steps

  1. Create the App on your server. Run the App command from the install guide with one more flag, --github-url:
docker run --rm -it --network host -v "$PWD/secrets:/out" <image> \
  github-app create --org <your-github-org> --url https://gitfence.example.com \
  --github-url https://github.example.com --out /out
  1. Copy the settings. The saved secrets/github-app.env already includes GITHUB_WEB_URL and GITHUB_API_URL. (If your API is not at <address>/api/v3, add --github-api-url to the command.) Copy its values into gitfence.env.
  2. Check the two addresses in gitfence.env:
    • GITHUB_WEB_URL=https://github.example.com: your server's address (https, no path). Sign-in, the App, repository links, clones and pull requests all use it.
    • GITHUB_API_URL: only if your REST API is not at <GITHUB_WEB_URL>/api/v3, the default.
  3. Install the App on the repositories Gitfence should manage, then start Gitfence and connect a repository as usual.

No inbound webhooks needed

If your GitHub Enterprise Server cannot reach Gitfence, set GITFENCE_GITHUB_EVENTS=poll in gitfence.env. Gitfence polls its REST API through GITHUB_API_URL, so reviews, comments, checks and notifications stay current without inbound webhooks. The default auto mode uses webhooks first and falls back to polling when needed.

Gotchas

  • Gitfence refuses to start when either address is malformed, and says which.
  • On github.com, leave both settings unset.
  • The App's private key stays on your Gitfence server. We never see it.

Next: self-hosting.