https://github.com/meyer1994/gitserver
A very simple git smart HTTP server
https://github.com/meyer1994/gitserver
asgi fastapi git git-server python uvicorn
Last synced: 19 days ago
JSON representation
A very simple git smart HTTP server
- Host: GitHub
- URL: https://github.com/meyer1994/gitserver
- Owner: meyer1994
- Created: 2020-09-04T03:00:03.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-09-17T23:11:46.000Z (9 months ago)
- Last Synced: 2025-09-18T01:10:55.077Z (9 months ago)
- Topics: asgi, fastapi, git, git-server, python, uvicorn
- Language: Python
- Homepage:
- Size: 35.2 KB
- Stars: 34
- Watchers: 1
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gitserver
[](https://github.com/meyer1994/gitserver/actions/workflows/build.yml)
[](https://github.com/RichardLitt/standard-readme)
A very simple git [smart HTTP][6] server.
## About
This was created as a learning experience on how to create, and possibly use,
a custom git server to upload your code. Also to play with some weird ideas...
## Install
We use [`fastapi`][1] to handle all the HTTP interface and [`uvicorn`][2] as the
[ASGI][3]
server.
```bash
$ pip install -r requirements.txt
```
## Usage
```bash
$ uvicorn app:app
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
```
Now you have an HTTP git server running on `localhost:8000`. You can push your
code to it simply by adding a remote that points to it:
```bash
$ git remote add local http://localhost:8000/reponame
# push to it
$ git push local
# clone from it
$ git clone http://localhost:8000/reponame
```
Note that the username/password is currently 'admin' for both. This is found in the [`gitserver/app.py`](./gitserver/app.py) file,
and you can edit that file if you'd like to change the username/password.
Note that the directory where the code is saved is created using python's
`tempfile` module. Which means, when the program exists, or reloads, it **will**
be deleted.
## Docker
There is also a [docker][7] image if you prefer that:
```bash
$ docker run --rm -it -p 8000:8000 meyer1994/gitserver
```
## Thanks
This project would not have been possible without the code in the following
repositories. They helped me understand a lot about git http backend.
- [git_http_backend.py][4]
- [grack][5]
[1]: https://fastapi.tiangolo.com/
[2]: https://uvicorn.org/
[3]: https://asgi.readthedocs.io/en/latest/index.html
[4]: https://github.com/dvdotsenko/git_http_backend.py
[5]: https://github.com/schacon/grack
[6]: https://www.git-scm.com/book/fa/v2/Git-on-the-Server-Smart-HTTP
[7]: https://hub.docker.com/repository/docker/meyer1994/gitserver