Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Control Access to a Git Server with Gitolite on Ubuntu

A practical Ubuntu guide to installing Gitolite, managing users in keydir, writing repository rules, limiting branch operations, and testing both allowed and denied Git actions.
Length11 min Posted Quest giverVGSources Team

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Gitolite lets one dedicated Ubuntu account host Git repositories while SSH keys identify virtual users and repository rules decide exactly what each user may do. Install Ubuntu’s gitolite3 package, initialize it with an administrator key, then make every user and permission change in the gitolite-admin repository. The forced SSH command accepts Git operations that match your rules and rejects interactive shell access.

What Gitolite controls

Git itself does not provide the central authorization model needed for a shared Git server. Gitolite adds that policy layer in front of Git over SSH. All Gitolite users normally connect through one dedicated Unix account, usually named git. Their SSH public keys are mapped to virtual Gitolite usernames, and those virtual identities are evaluated against repository and ref rules.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When a client connects, SSH invokes Gitolite’s forced command instead of an ordinary shell. The command examines the requested repository and operation, then permits or denies it according to the compiled configuration. A user can clone, fetch, or push where authorized, but cannot turn the connection into an interactive server session. Gitolite’s user guide summarizes the design: “You do not get a shell on the server — the whole point of gitolite is to prevent that!”

This arrangement gives you a single, reviewable control plane:

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
  • Identity: public-key files in keydir map keys to virtual names such as alice or carol.
  • Authorization: conf/gitolite.conf states which identities or groups can read, write, or force-update which repositories and refs.
  • Change management: committing and pushing the gitolite-admin repository regenerates Gitolite’s SSH authorization data and applies the new rules.

Do not edit generated SSH files, Gitolite’s internal state, or bare repositories by hand. Those files are managed outputs; the administrator repository is the supported input.

Prerequisites and a safe account layout

The upstream Gitolite setup documentation requires Git and Perl on the server. Use a dedicated hosting account rather than an existing human login. The account should be used for Gitolite’s forced SSH handling and should not be granted an interactive shell.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • An Ubuntu server with administrative sudo access.
  • Git and Perl available to the account that runs Gitolite.
  • An administrator’s SSH public key, such as ~/.ssh/id_ed25519.pub.
  • A hostname or address that clients can use as yourserver.
  • A decision about the Unix hosting name. The commands below use git.

Gitolite users are not Unix accounts. Adding keydir/alice.pub creates the virtual identity alice; it does not add an entry to /etc/passwd or create another login on Ubuntu.

Install Gitolite and initialize the server

Ubuntu supplies the gitolite3 package. The following sequence creates the dedicated account, copies the administrator key to a temporary location, and performs the initial setup as the hosting user.

  1. Install the package:

    sudo apt install gitolite3

    The package installer may ask for an administrator key and storage choices. If you want the hosting username to remain git and intend to customize storage, the Ubuntu procedure recommends leaving the package prompt empty, then completing setup explicitly.

  2. Create the dedicated system account with its home directory:

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    sudo useradd --system --home /home/git --create-home git
  3. Copy the administrator’s public key to a temporary path readable during setup:

    cp ~/.ssh/id_ed25519.pub /tmp/admin.pub

    Use the actual public-key filename if your administrator key has a different name. Copy only the public key, never the private key.

  4. Initialize Gitolite as the dedicated account:

    sudo -i -u git gitolite setup -pk /tmp/admin.pub

    The -pk option imports the administrator public key. Gitolite creates its managed SSH configuration, internal state, and initial administration repository under the hosting account’s home and storage locations.

    Rank #2
    Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
    • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
    • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
    • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
    • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
    • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Keep ownership and permissions on the hosting account’s managed files as Gitolite expects. Do not make the administrator’s key file or generated authorization files writable by unrelated users.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Confirm the SSH entry point before adding policy

After setup, test the account through SSH rather than attempting to log in with a shell. From the administrator workstation, run:

ssh git@yourserver

You can request the explicit information command instead:

ssh git@yourserver info

The info response shows the repositories visible to the key being used. A successful response confirms that the key was imported and that Gitolite’s forced SSH handling is active. It does not grant shell access; the connection is still handled by Gitolite.

Use gitolite-admin as the control plane

Clone the administration repository with the administrator key:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
git clone git@yourserver:gitolite-admin.git
cd gitolite-admin

Two paths matter for routine access management:

Path Purpose Typical change
keydir/ Maps SSH public keys to virtual Gitolite usernames. Add keydir/alice.pub or remove an obsolete key.
conf/gitolite.conf Defines repositories, groups, permission classes, and ref restrictions. Give a reviewer read access or limit a contributor to selected refs.

Every change should be understandable in a normal Git diff. Review the diff locally, commit it with a meaningful message, and push it. The push is the event that causes Gitolite to regenerate authorization data and enforce the new policy.

Add, rename, and remove users

Add a virtual user

Copy the user’s public key into keydir, using the desired virtual username as the filename:

cp /path/to/alice.pub keydir/alice.pub
git add keydir/alice.pub
git commit -m "Add Alice"
git push

The basename becomes the identity used in permission rules. The person still connects through git@yourserver; Gitolite associates the presented key with alice
en
.

Remove access

Delete the key file, then commit and push the deletion:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
git rm keydir/alice.pub
git commit -m "Remove Alice access"
git push

Once the administration push completes, that key no longer maps to a Gitolite user. Removing a key does not require deleting a Unix account because virtual users are stored in the repository, not in Ubuntu’s account database.

Use groups for maintainable policy

Groups let one rule cover several identities. The following declaration creates two groups:

@developers = alice bob
@reviewers  = carol

Keep group membership close to the rules that consume it, and use descriptive names that reflect responsibility rather than a temporary project. A user can appear in more than one group when the resulting permissions are intentional.

Grant repository permissions with gitolite.conf

A compact repository policy looks like this:

repo project
    RW      = @developers
    R       = @reviewers
    RW+     = admin

The permission classes are cumulative in capability, but they are not interchangeable:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rule Allows Use when Risk or limitation
R Read operations such as cloning and fetching. A reviewer or consumer must see the repository but must not publish changes. Cannot push updates.
RW Read and ordinary write operations. A contributor should push changes without force-updating refs. Does not include the force-update privilege implied by RW+.
RW+ Read, write, and force updates that can rewind or otherwise replace refs. A trusted maintainer must perform history rewrites or other privileged ref operations. Can delete or rewind published history; grant sparingly.

Use the least powerful class that meets the job. Most developers need RW, reviewers need R, and only a small number of maintainers should receive RW+.

Repository-specific rules

Rules under a repo block apply only to that repository. For example, a second repository can have a different group or a completely read-only policy:

repo documentation
    R = @reviewers

A user’s access is therefore determined by the repository named in the client’s Git URL, not merely by membership in a global group.

Restrict branches or tags with ref patterns

When repository-wide write access is too broad, add a ref-pattern rule. The Ubuntu example uses:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
repo project
    RW              = @developers
    RW+ dev/        = alice
    R               = @reviewers

Here, developers retain normal write access, while alice receives the stronger force-update privilege only for refs matching the dev/ pattern. Ref-pattern rules let you separate ordinary contribution from maintenance of selected branches or tags. Treat every pattern that permits rewinding or deletion as privileged, and test both a matching and a non-matching ref.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Apply an access change safely

Use the same reviewable sequence for user and authorization changes:

  1. Edit: change files in keydir and/or conf/gitolite.conf.
  2. Inspect: run git diff and check filenames, group membership, repository names, permission classes, and ref patterns.
  3. Commit: create a focused commit describing the access decision.
  4. Push: send the commit to gitolite-admin. Gitolite compiles the resulting configuration and updates SSH authorization.
  5. Inspect the effective view: run ssh git@yourserver info with the relevant key.
  6. Exercise the policy: test an operation that should work and one that should fail.

Keeping each policy change in version control gives administrators an audit trail and a straightforward rollback path: identify the bad administration commit, review the inverse change, and push the corrective commit through the same control plane.

Test positive and negative cases

Check what a key can see

Run the information command with the key that represents the user under test:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ssh git@yourserver info

The listed repositories should match the intended read visibility. If a repository is absent, check that the key filename, group membership, and repository block all use the same spelling.

Test an allowed clone or fetch

The normal SSH URL format is git@yourserver:repo. For the example repository:

git clone git@yourserver:project.git

A user with R, RW, or RW+ should be able to clone and fetch according to the repository rule.

Test ordinary push access

For a user granted RW, make a harmless branch or commit in a test working copy and push it. The push should succeed without allowing a force update. A reviewer with only R should receive a denial when attempting the same push.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test force-update boundaries

Use a controlled test branch to verify that an RW+ rule permits the intended ref operation and that an ordinary RW identity is denied. If a ref pattern is present, test a ref that matches the pattern and another that does not; this catches rules that are broader or narrower than intended.

Always include a negative case in a change review. A successful clone alone proves only that read access works; it does not prove that write, force-update, or repository isolation is correct.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why users cannot obtain a server shell

All users arrive at the same Unix account, but Gitolite’s SSH key entries include forced handling that dispatches Gitolite rather than a shell. The requested command is interpreted as a Git operation, checked against the virtual user and repository policy, and then allowed or rejected. Consequently:

  • A permitted Git protocol request can operate on an authorized repository.
  • A request for a repository or ref outside the policy is denied.
  • An interactive shell is not provided through the Gitolite account.

Do not “fix” a connection problem by assigning the hosting account an interactive shell or by editing ~git/.ssh/authorized_keys. Such changes bypass the security model and can be overwritten by Gitolite. Diagnose the key and policy in the administration repository instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot the common failure modes

Permission denied (publickey)

  • Confirm the client is offering the private key that matches the public key imported during setup.
  • Check that the public key exists under the expected virtual username in keydir and that the filename ends in .pub.
  • Verify that the key addition was committed and pushed to gitolite-admin; editing a local clone alone has no effect.
  • Use the intended host and account in the SSH target: git@yourserver.

The repository is not visible in info

  • Check the exact repository name in the repo block and in the client URL.
  • Confirm the key’s virtual username is included directly or through the expected group.
  • Make sure the administration commit that changed the rule was pushed successfully.

Clone works but push is denied

This normally indicates read-only policy. Inspect whether the identity has R rather than RW or RW+, and verify that the push targets the repository covered by the rule. If the attempted ref is restricted by a pattern, compare its name with the pattern before changing permissions.

Force push is denied

RW intentionally does not include the force-update privilege. Grant RW+ only to the trusted maintainer and, where possible, constrain it with a ref pattern. Re-test a matching and non-matching ref after pushing the policy change.

An unexpected shell or file change appears

Stop and inspect the hosting account. Gitolite expects to own and manage its authorization files, internal state, and bare repositories. Restore administration through gitolite-admin rather than hand-editing generated files, and ensure the hosting account remains dedicated to Gitolite.

Choose a policy by risk, not convenience

Role or case Recommended scope Permission Additional control
External or occasional reviewer Only the repository that must be inspected R No push capability; verify visibility with info.
Regular contributor Assigned project repositories RW Keep force updates unavailable.
Release or history maintainer Specific maintenance repository or refs RW+ Restrict with a ref pattern whenever possible.
New project Named repository block Start with no users, then add groups deliberately Review the first clone, push, and denied operation.
Departing user All repositories using the key Remove the key file Commit and push the deletion, then retest with the former key.

Evaluate a proposed rule on repository scope, read versus write rights, force-update ability, branch or tag restrictions, group membership, and the audit trail created by the administration repository. If you cannot explain why a person needs RW+, use RW or R instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A complete minimal example

After importing the administrator key, the following files establish two roles for one project:

# keydir/alice.pub
# keydir/bob.pub
# keydir/carol.pub

# conf/gitolite.conf
@developers = alice bob
@reviewers  = carol

repo project
    RW              = @developers
    RW+ dev/        = alice
    R               = @reviewers

Commit and push those files, then perform these checks:

  1. As Alice, confirm project appears in ssh git@yourserver info, clone it, push an ordinary change, and test the permitted dev/ force-update in a controlled ref.
  2. As Bob, clone and push an ordinary change, then confirm a force update is rejected.
  3. As Carol, clone or fetch the project, confirm that a push is rejected, and verify that no unrelated repository appears.
  4. With a key not present in keydir, confirm that SSH authentication or Gitolite authorization fails rather than granting accidental access.

This verifies identity mapping, repository visibility, normal writes, privileged ref operations, read-only behavior, and denial boundaries instead of checking only the happy path.

Rules to keep the server maintainable

  • Use SSH public-key authentication; passwords are not the normal Gitolite SSH workflow.
  • Keep the hosting account dedicated and without an interactive shell.
  • Make all changes through gitolite-admin so they can be reviewed, audited, and reverted.
  • Never hand-edit generated authorized_keys, ~git/.gitolite, or bare repositories.
  • Treat RW+, ref deletion, and rewinding as privileged operations.
  • After every policy push, check the effective info output and run both permitted and prohibited Git operations.

With this workflow, Ubuntu supplies the package and Unix account, SSH supplies key authentication, and Gitolite supplies the virtual identities and fine-grained repository policy. The administration repository remains the single place where access is defined and changed.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.