alpine-git

tdihp/alpine-git Docker Image

tdihp
自动构建

基于Alpine Linux的轻量Git容器,适用于RancherOS等无包管理器的小型Linux发行版,支持git、http/https、ssh协议,可便捷执行各类Git命令。

下载次数: 0状态:自动构建维护者:tdihp仓库类型:镜像最近更新:

镜像概述

这是一个运行在Alpine Linux上的轻量Git容器,特别适用于RancherOS等无包管理器的小型Linux发行版,帮助用户在这类系统中快速执行Git相关操作。

核心功能

  • 支持git、http/https、ssh多种协议
  • 可执行clone、add、commit、push等全量Git命令
  • 轻量高效,基于Alpine Linux构建,资源占用极低

使用场景

  • 在无包管理器的小型Linux系统(如RancherOS)中临时执行Git操作
  • 快速搭建临时Git环境,无需在主机安装Git
  • 跨环境保持一致的Git版本和配置

配置说明

直接运行命令

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

示例:克隆仓库

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

方法1:添加bash函数到配置文件

将以下函数添加到~/.bashrc或~/.profile中:

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

执行source ~/.profile生效后,可直接使用git命令,如:

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

方法2:设置别名

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

注意:

  • 切换仓库时需重新定义别名
  • 需在Git仓库根目录下执行该别名命令

演示示例

bash
cd application
alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh tdihp/alpine-git"
git clone ***:YOUR_ACCOUNT/YOUR_REPO.git
cd YOUR_REPO
alias git="docker run -ti --rm -v $(pwd):/git -v $HOME/.ssh:/root/.ssh tdihp/alpine-git"
# 编辑文件
git add .
git status
git commit -m "test"
git push -u origin master

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 alpine-git 镜像标签

docker pull docker.xuanyuan.run/tdihp/alpine-git:<标签>

DockerHub 原生拉取命令

docker pull tdihp/alpine-git:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告