A remote git server docker image.
Instructions:
- Clone this git repo on the computer you would like to set up as a remote git server:
git clone https://github.com/mhowlett/dockgit.git
- Create an authorized_keys file by concatenating any number of public keys together:
cd dockgit
cat ~/.ssh/id_rsa.pub >> authorized_keys
cat [some other public key] >> authorized_keys
...
- Build the docker image with:
docker build -t dockgit .
- Create a data directory
mkdir /data
note that the folder /data/dockgit/repos will be created when you bring the container up.
- bring up the container:
./docker-up.sh
- to make new repo:
log in as git:
ssh -p 2332 git@localhost
cd /repos
mkdir example.git
cd example.git
git --bare init
- to push to the new repo:
on your local machine:
mkdir example
cd example
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin ssh://git@<server>:2332/repos/example.git
git push origin master
to clone an existing repo:
git clone ssh://git@globalonset.com:2332/repos/example.git