GithubHelp home page GithubHelp logo

git-server-docker's Introduction

git-server-docker

A lightweight Git Server Docker image built with Alpine Linux. Available on GitHub and Docker Hub

"image git server docker" "git server docker"

Basic Usage

How to run the container in port 2222 with two volumes: keys volume for public keys and repos volume for git repositories:

$ docker run -d -p 2222:22 -v ~/git-server/keys:/git-server/keys -v ~/git-server/repos:/git-server/repos jkarlos/git-server-docker

How to use a public key:

Copy them to keys folder: 
- From host: $ cp ~/.ssh/id_rsa.pub ~/git-server/keys
- From remote: $ scp ~/.ssh/id_rsa.pub user@host:~/git-server/keys
You need restart the container when keys are updated:
$ docker restart <container-id>

How to check that container works (you must to have a key):

$ ssh git@<ip-docker-server> -p 2222
...
Welcome to git-server-docker!
You've successfully authenticated, but I do not
provide interactive shell access.
...

How to create a new repo:

$ cd myrepo
$ git init --shared=true
$ git add .
$ git commit -m "my first commit"
$ cd ..
$ git clone --bare myrepo myrepo.git

How to upload a repo:

From host:
$ mv myrepo.git ~/git-server/repos
From remote:
$ scp -r myrepo.git user@host:~/git-server/repos

How clone a repository:

$ git clone ssh://git@<ip-docker-server>:2222/git-server/repos/myrepo.git

Arguments

  • Expose ports: 22
  • Volumes:
  • /git-server/keys: Volume to store the users public keys
  • /git-server/repos: Volume to store the repositories

SSH Keys

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

Build Image

How to make the image:

$ docker build -t git-server-docker .

Docker-Compose

You can edit docker-compose.yml and run this container with docker-compose:

$ docker-compose up -d

git-server-docker's People

Contributors

jkarlosb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.