This repo extends the service provided by Github and adds ability to deploy on K8s
A lightweight Git Server Docker image built with Alpine Linux. Available on GitHub and Docker Hub
Copy the ssh-key id_rsa.pub from the server which will connect to the git and replace in the configmap in deploy.yaml
How to use a public key: Copy them to keys folder: - From kubernetes: ... $ kubectl cp :<public key location inside .ssh folder> $ kubectl cp :~/git-server/repos ...
Run the below kubectl apply -f deploy.yaml kubectl apply -f svc.yaml
How to check that container works (you must have a key):
$ ssh git@<git-svc-address>
...
Welcome to git-server-docker!
You've successfully authenticated, but I do not
provide interactive shell access.
...
How to create a new repo:
On a local machine
$ mkdir myrepo.git
$ cd myrepo.git
$ git init --baare
How to upload a repo to kubernetes
From host:
$ kubectl cp ./myrepo.git <pod-name-for-gitservice>:/git-server/repos -n <git workspace
How clone a repository:
$ git clone ssh://git@<git-svc-address>:/git-server/repos/myrepo.git
- Expose ports: 22
- Volumes:
- /git-server/keys: Volume to store the users public keys
- /git-server/repos: Volume to store the repositories
How generate a pair keys in client machine:
$ ssh-keygen -t rsa
How upload quickly a public key to host volume:
$ scp ~/.ssh/id_rsa.pub user@host:~/git-server/keys
How to make the image:
$ docker build -t git-server-docker .