Python-based Git Server
Project description
Overview
A git server implementation written in python.
Based off the amazing work by Stewart Park in this gist: https://gist.github.com/stewartpark/1b079dc0481c6213def9.
Features:
- Makes any git repository lying below the search_paths setting
available for
git clone
andgit push
via HTTP using basic authentication - Application defaults can be overridden by specifying a configuration file
Review etc/config.yaml for a sample data structure. - On-demand repos: If you attempt to push a non-existing repo to the server, it will be created
- Employs process threading via gunicorn
Installation
- Install from pypi.org:
pip install btgitserver
- Install directly from git repo:
pip install git+http://www.github.com/berttejeda/bert.gt-server.git
Usage
To get usage information and help: bt.git-server -h
Clone paths
These are the routes accepted by the script:
- '/<org_name>/<project_name>'
These routes mirror the directory structure under the git search path(s).
Authentication
For now, the only authentication available is HTTP AUTH BASIC
As such, the default credentials are:
Username: git-user
Password: git-password
Usage Examples
Clone a repo
- Create a test org and repo:
cd ~
mkdir -p /tmp/repos/contoso/test
cd /tmp/repos/contoso/test
git init .
git checkout -b main
touch test_file.txt
git add .
git commit -m 'Initial Commit'
cd ~
bt.git-server -r /tmp/repos
Note: The --repo-search-paths/-r
cli option allows specifying
multiple, space-delimited search paths, e.g. bt.git-server -r /tmp/repos /tmp/repos2
- Launch the standalone git server
bt.git-server
You should see output similar to:
Running on http://0.0.0.0:5000/
- On client-side:
Try cloning the repo you just created via the supported routes:
e.g.
git clone http://git-user:git-password@127.0.0.1:5000/contoso/test
Push an on-demand repo
mkdir -p foo-bar
cd foo-bar
git init .
git remote add origin http://git-user:git-password@127.0.0.1:5000/contoso/foo-bar
git checkout -b main
touch test_file.txt
git add .
git commit -m 'Initial Commit'
git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
Docker
For your convenience, a Dockerfile has been provided, so feel free to build your own containerized instance of this app, or use the pre-built docker image:
mkdir /tmp/repos
docker run -it --rm -p 5000:5000 \
-v /tmp/repos:/opt/git-server/repos \
berttejeda/git-server
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file btgitserver-3.1.0.tar.gz
.
File metadata
- Download URL: btgitserver-3.1.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c88f76ac2b95e6da72abeac9b18efde8d049da079f2da740f290d28256d5ada |
|
MD5 | a7864c162cf4341ac85d2c468e0cc8b7 |
|
BLAKE2b-256 | 482f9e1716898ef6d6ba39968facf2c63f767a492dcdafee41407e4d066305f7 |
File details
Details for the file btgitserver-3.1.0-py3-none-any.whl
.
File metadata
- Download URL: btgitserver-3.1.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdb0f653a16037dacb715e2bda9a08bc7be26d192fd7ff05c3b53d4f72e5fcd9 |
|
MD5 | ee9105086588bc24cef30e5d35e9dad8 |
|
BLAKE2b-256 | 8c6af4cf1d16d2f03fe432b6406d99ff6801cba32f31bbdd9a114b120d5b067d |