woodpecker/docs/build/clone.md

37 lines
1.4 KiB
Markdown
Raw Normal View History

2015-07-07 04:13:50 +00:00
# Clone
2015-07-08 01:08:43 +00:00
Drone automatically clones your repository and submodules at the start of your build. No configuration is required. You can, however, use the `clone` section of the `.drone.yml` to customize this behavior as needed.
2015-07-07 04:13:50 +00:00
## Clone Options
The custom clone options are:
2015-07-08 01:08:43 +00:00
* `depth` - creates a shallow clone with truncated history
* `recursive` - recursively clones git submodules
* `path` - relative path inside `/drone/src` where the repository is cloned
2015-07-07 04:13:50 +00:00
This is an example yaml configuration:
2015-07-08 01:08:43 +00:00
```yaml
2015-07-07 04:13:50 +00:00
clone:
depth: 50
recursive: true
path: github.com/drone/drone
```
2015-07-08 01:08:43 +00:00
Which results in the following command:
2015-07-07 04:13:50 +00:00
```
git clone --depth=50 --recusive=true \
https://github.com/drone/drone.git \
/drone/src/github.com/drone/drone
```
2015-07-08 01:08:43 +00:00
## Clone Private Repos
2015-07-07 04:13:50 +00:00
2015-07-08 01:08:43 +00:00
Cloning a private repository requires authentication to the remote system. Drone prefers `git+https` and `netrc` to authenticate, but will fallback to `git+ssh` and deploy keys if not supported.
2015-07-07 04:13:50 +00:00
2015-07-10 00:01:03 +00:00
Drone prefers `git+https` for authentication because it allows you to clone multiple private repositories. This is helpful when you have git submodules or third party dependencies you need to download (via `go get` or `npm install` or others) that are sourced from a private repository.
2015-07-07 04:13:50 +00:00
2015-07-08 01:08:43 +00:00
Drone only injects the `netrc` and `id_rsa` files into your build environment if your repository is private, or running in private mode. We do this for security reasons to avoid leaking sensitive data.