Git Server is a Dockerized application designed to store repositories for sharing with robots locally via SSH.
To build the Docker image, execute the following command in the project directory:
docker build . -t git-server
Before creating container, make sure that you have created a directory named my_repo_dir
on your home directory using this command:
mkdir ${HOME}/my_repo_dir
feel free to modify it for your shared repository.
To run the Git Server as a Docker container, use the following command:
docker run --name my_git_server -it -d -p 1248:22 -v $HOME/my_repo_dir/:/repo_dir git-server:latest
To run the Git Server as a Docker container, use the following command:
docker-commpose up
Once the container is running, you can access the Git Server via SSH using the specified port:
ssh -p 1248 root@your_ip
To clone a repository from the Git Server, use the following command:
git clone ssh://root@your_ip:1248/repo_dir/repository.git
Before pushing or pulling, set the server repository config into bare using this command:
git config --local core.bare true
After setting the server into bare, the client now can push or pull using the following command:
# Push to Git Server
git push origin your_branch
# Pull from Git Server
git pull origin your_branch
feel free to replace your_branch
with the appropriate branch name