https://github.com/woodpecker-ci/plugin-git
Woodpecker plugin for cloning Git repositories
https://github.com/woodpecker-ci/plugin-git
ci git hacktoberfest plugin woodpecker-ci woodpecker-plugin woodpeckerci
Last synced: 5 months ago
JSON representation
Woodpecker plugin for cloning Git repositories
- Host: GitHub
- URL: https://github.com/woodpecker-ci/plugin-git
- Owner: woodpecker-ci
- License: apache-2.0
- Created: 2021-09-26T15:28:31.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-05-04T17:51:41.000Z (5 months ago)
- Last Synced: 2025-05-04T18:33:30.807Z (5 months ago)
- Topics: ci, git, hacktoberfest, plugin, woodpecker-ci, woodpecker-plugin, woodpeckerci
- Language: Go
- Homepage: https://woodpecker-ci.org/plugins/git-clone
- Size: 496 KB
- Stars: 21
- Watchers: 6
- Forks: 29
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# plugin-git
Woodpecker plugin to clone `git` repositories. For the usage information and a listing of the available options please take a look at [the docs](https://woodpecker-ci.org/plugins/Git%20Clone).
The docs are also available in [`docs.md` in this repository](docs.md).## Build
Build the binary with the following command:
```console
export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=ongo build -v -a -tags netgo -o release/linux/amd64/plugin-git
```## Docker
Build the Docker image with the following command:
```console
docker buildx build \
--label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
--platform linux/amd64 --output type=docker \
--file docker/Dockerfile.multiarch --tag woodpeckerci/plugin-git .
```*The platform linux/amd64 should be replaced by the correct platform.*
This will build the image and load it into docker so the image can be used locally.
[More information on the output formats can be found in docker buildx doc](https://docs.docker.com/engine/reference/commandline/buildx_build/#output).## Usage
Clone a commit:
```console
docker run --rm \
-e CI_REPO_REMOTE=https://github.com/garyburd/redigo.git \
-e CI_WORKSPACE=/go/src/github.com/garyburd/redigo \
-e CI_BUILD_EVENT=push \
-e CI_COMMIT_SHA=d8dbe4d94f15fe89232e0402c6e8a0ddf21af3ab \
-e CI_COMMIT_REF=refs/heads/master \
woodpeckerci/plugin-git
```Clone a pull request:
```console
docker run --rm \
-e CI_REPO_REMOTE=https://github.com/garyburd/redigo.git \
-e CI_WORKSPACE=/go/src/github.com/garyburd/redigo \
-e CI_BUILD_EVENT=pull_request \
-e CI_COMMIT_SHA=3b4642018d177bf5fecc5907e7f341a2b5c12b8a \
-e CI_COMMIT_REF=refs/pull/74/head \
woodpeckerci/plugin-git
```Clone a tag:
```console
docker run --rm \
-e CI_REPO_REMOTE=https://github.com/garyburd/redigo.git \
-e CI_WORKSPACE=/go/src/github.com/garyburd/redigo \
-e CI_BUILD_EVENT=tag \
-e CI_COMMIT_SHA=3b4642018d177bf5fecc5907e7f341a2b5c12b8a \
-e CI_COMMIT_REF=refs/tags/74/head \
woodpeckerci/plugin-git
```## Build arguments
### HOME
The docker image can be build using `--build-arg HOME=`.
This will create the directory for the custom home and set the custom home as the default value for the `home` plugin setting (see [the plugin docs](./docs.md) for more information about this setting).