Skip to content
A useful simple git container running in alpine linux, especially for tiny linux distro, such as RancherOS, which don't have package manager.
Branch: master
Clone or download
Bill Wang
Latest commit c5b7aa9 Feb 26, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml update build script Feb 26, 2019
Dockerfile Install GNU Less Jan 29, 2019
LICENSE Initial commit Jan 19, 2016
Makefile Add build scripts Feb 26, 2019
README.md update build script Feb 26, 2019
build.sh update build script Feb 26, 2019

README.md

docker-git-alpine

A useful simple git container running in alpine Linux, especially for tiny Linux distro, such as RancherOS, which doesn't have a package manager.

DockerHub Badge

Github Repo

https://github.com/alpine-docker/git

Daily travis CI build logs

https://travis-ci.org/alpine-docker/git

Docker iamge tags

https://hub.docker.com/r/alpine/git/tags/

usage

docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git <git_command>

For example, if you need clone this repository, you can run

docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git clone https://github.com/alpine-docker/git.git

Optional usage 1:

To save your type, add this fuction to ~/.bashrc or ~/.profile

$ cat ~/.profile

...

function git () {
    (docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git "$@")
}

...

$ source ~/.profile

for example, if you need clone this repository, with the function you just set, you can run it as local command

git clone https://github.com/alpine-docker/git.git

Optional usage 2:

alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh alpine/git"

NOTES:

  • You need redefine (re-run) the alias, when you switch between different repositories
  • You need run above alias command only under git repository's root directory.

Demo

$ cd application
$ alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh alpine/git"
$ git clone git@github.com:YOUR_ACCOUNT/YOUR_REPO.git
$ cd YOUR_REPO
$ alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh alpine/git"
# edit several files
$ git add . 
$ git status
$ git commit -m "test"
$ git push -u origin master

The Protocols

Supports git, http/https and ssh protocols.

Refer: Git on the Server - The Protocols

You can’t perform that action at this time.