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 cloneandgit pushvia 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.git-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
Metadata
Release files for btgitserver 3.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| btgitserver-3.3.0.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| btgitserver-3.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.8 kB
Release files / btgitserver-3.3.0.tar.gz
| Download URL | btgitserver-3.3.0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e0673ccc6d967fac0cdf5e2bfd853e0d2ed407a4e9b4d6d18da5e1ebeeed7b9
|
|
BLAKE2b-256 checksum How to use checksums |
c75c6b792c5b4e8ed518701bfeaed36030647eb7492629361d5d7aeff8b7c3f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / btgitserver-3.3.0-py3-none-any.whl
| Download URL | btgitserver-3.3.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
291bed6c2834ed9dfe49bb2609e395b5b7699c30678bb3a2cb6ca3ce5d5b86a4
|
|
BLAKE2b-256 checksum How to use checksums |
17b13366bcca2b5db5950f59c5fbe499c3dbc93bb1d22f9e7197ce50afbb707d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|