惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Cloudbric
Cloudbric
P
Palo Alto Networks Blog
T
Threatpost
T
Tor Project blog
T
Tenable Blog
AWS News Blog
AWS News Blog
Project Zero
Project Zero
L
LangChain Blog
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Latest
Security Latest
云风的 BLOG
云风的 BLOG
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
MongoDB | Blog
MongoDB | Blog
aimingoo的专栏
aimingoo的专栏
K
Kaspersky official blog
Jina AI
Jina AI
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Secure Thoughts
TaoSecurity Blog
TaoSecurity Blog
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
IT之家
IT之家
Forbes - Security
Forbes - Security
The Hacker News
The Hacker News
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
Y
Y Combinator Blog

Emil Burzo

GPS spoofing teleported me to Peru, mid-flight Running Claude Code dangerously (safely) Reverse engineering the Nest home/away API Tracking down an old OkHttp regression What does StackOverflow's personalized prediction data think of you? Cum se plătesc impozitele PFA prin BT24 Work-around for when keyserver.ubuntu.com is down Creating a tailable cursor on MongoDB 3 with the Java driver API Quick fix for CVE-2015-1328 Analiza parcului auto din România
Setting up gitolite on Ubuntu 12.04 LTS
2014-02-19 · via Emil Burzo

Introduction

In this post we will be looking at how to self-host git using gitolite.

First off, you will have to decide if you are ok with using the (slightly older) version in the Ubuntu package repository.

Right now, gitolite is at version 3, while the version in the LTS repository is 2.

Moving on, in this guide we will be using the repository version.

Setup

Use apt-get to install gitolite

sudo apt-get install gitolite

After that’s done, we proceed with configuring gitolite:

sudo dpkg-reconfigure gitolite

You will be presented with some pretty dialog… dialogs with the following questions:

System username for gitolite

You can leave the default gitolite username, but if you want to type less when cloning git repositories, you can set it to git (don’t forget to check if the username not already taken by something else on the system)

Repository path

If you are unsure, you can leave the default.

Personally, I prefer /home/gitolite

Administrator’s SSH key

You can either upload your public key file (you do have one, right? if not, see here) somewhere on the server and input the path to the file, or paste it directly.

The administrative repository

Gitolite operates under the principle that you have an administrative repository, and you configure everything from there.

Therefore, we clone the administrative repository:

git clone GITOLITE_USERNAME@SERVER_ADDRESS:gitolite-admin.git

For example:

git clone git@192.168.0.146:gitolite-admin.git

This URI scheme assumes you are using the standard SSH port (22).

If that is not the case, you will have to use the following, lengthier syntax:

git clone ssh://GITOLITE_USERNAME@SERVER_ADDRESS:SERVER_PORT/gitolite-admin.git

Example:

git clone ssh://git@192.168.0.146:12345/gitolite-admin.git

By default, the gitolite administrative repository looks like this:

gitolite-admin/
|-- conf                      <-- configuration dir
|   `-- gitolite.conf         <-- configuration file
`-- keydir                    <-- key store directory
    `-- admin.pub             <-- key file, must end in .pub

Creating a new repository

We edit the gitolite-admin/conf/gitolite.conf file and add the following:

repo    REPOSITORY_NAME
        RW+     =   USER_KEY_NAME

For example:

repo    testing
        RW+     =   admin

The permission types are:

  • R means “read” permission
  • RW means “read and write”, but no rewind
  • RW+ means “read and write”, with rewind allowed

Save the config file then commit the changes:

git add .
git commit -m "created testing repository"
git push

Git documentation is outside the scope of the tutorial.

Congratulations! You now have a new repository which you can clone like so:

git clone git@192.168.0.146:testing.git

And that’s it!

But what if we want to give someone else access to our repository?

Adding a new user

First, you need to add his or hers ssh public key to the keydir folder in a file with the following name: user.pub

After that, we edit the gitolite.conf file and add the user to the appropriate directory.

From the gitolite-admin folder, we save and push everything:

git add -A .
git commit -m "added user XXX"
git push

And that should be it.

Tips

  • A user can have multiple key files, just add more files and keep this naming pattern: user@host.pub, user@another-host.pub, user@whatever.pub. And in the config file you can just reference ‘user’ and it will work with any of the previous three keys.
  • Use an openssh ssh_config file to simplify git URIs or ssh connections