docs/versioned_docs/version-0.17.2/api/remote-modules.mdx
Dagger supports the use of HTTP and SSH protocols for accessing remote repositories as Dagger modules, compatible with all major Git hosting platforms such as GitHub, GitLab, BitBucket, Azure DevOps, Codeberg, and Sourcehut. Dagger supports authentication via both HTTPS (using Git credential managers) and SSH (using a unified authentication approach).
Dagger supports various reference schemes for Dagger modules, as below:
| Protocol | Scheme | Authentication | Example |
|---|---|---|---|
| HTTP(S) | Go-like ref style | Git credential manager | github.com/username/repo[/subdir][@version] |
| HTTP(S) | Git HTTP style | Git credential manager | https://github.com/username/repo.git[/subdir][@version] |
| SSH | SCP-like | SSH keys | [email protected]:username/repo.git[/subdir][@version] |
| SSH | Explicit SSH | SSH keys | ssh://[email protected]/username/repo.git[/subdir][@version] |
Dagger provides additional flexibility in referencing modules through the following options:
.git extension is optional for HTTP refs or explicit SSH refs, except for GitLab, when referencing modules stored on a private repo or private subgroup./subpath to access a specific subdirectory within the repository.@version to target a particular version of the module. This can be a tag, branch name, or full commit hash. If omitted, the default branch is used.Here is an example of using a Go builder Dagger module from a public repository over HTTPS:
dagger -m github.com/kpenfound/dagger-modules/[email protected] call \
build --source=https://github.com/dagger/dagger --args=./cmd/dagger \
export --path=./build
Here is the same example using SSH authentication. Note that this requires SSH authentication to be properly configured on your Dagger host).
dagger -m [email protected]:kpenfound/dagger-modules/[email protected] call \
build --source=https://github.com/dagger/dagger --args=./cmd/dagger \
export --path=./build
Dagger supports both HTTPS and SSH authentication for accessing remote repositories.
For HTTPS authentication, Dagger uses your system's configured Git credential manager. This means if you're already authenticated with your Git provider, Dagger will automatically use these credentials when needed.
The following credential helpers are supported:
.gitconfigTo verify if your credentials are properly configured, try cloning a private repository (replace the placeholders below with valid values):
git clone https://github.com/USER/PRIVATE_REPOSITORY.git
If this works, Dagger will be able to use the same credentials to access your private repositories.
gh auth login or configure credentials via Git Credential Managerglab auth login or configure credentials via Git Credential ManagerDagger mounts the socket specified by your host's SSH_AUTH_SOCK environment variable to the Dagger Engine. This is essential for SSH refs, as most Git servers use your SSH key for authentication and tracking purposes, even when cloning public repositories.
This means that you must ensure that the SSH_AUTH_SOCK environment variable is properly set in your environment when using SSH refs with Dagger.
Read detailed instructions on setting up SSH authentication, including how to generate SSH keys, start the SSH agent, and add your keys.
For quick and easy referencing:
#version (for directory arguments) or @version (for modules).#version:subpath (for directory arguments) or add a /subpath (for modules). Remember that the version is mandatory when specifying a subpath.This section outlines current limitations and provides workarounds for common issues. We're actively working on improvements for these areas.
Currently, SSH refs are fully supported on UNIX-based systems (Linux and macOS). Windows support is under development. Track progress and contribute to the discussion in our GitHub issue for Windows support.
SSH forwarding may fail when multiple keys are loaded in your SSH agent. This is under active investigation in our GitHub issue. Until this is resolved, the following workaround may be used:
ssh-add -Dssh-add /path/to/key