Skip to main content

Reuse local credentials

DevPod will automatically make certain local credentials available inside of the development container through a credentials helper. This allows you to reuse existing local credentials in a safe manner within the development container without explicitly configuring them inside each workspace. Currently DevPod supports this feature for git credentials and docker credentials.

Git credentials​

DevPod will make https credentials available inside the dev container through a git credentials helper. ssh credentials are available through agent-forwarding that will be configured automatically on the ssh configuration for the workspace.

If you don't want DevPod to inject the credentials, you can disable that via the following command for all workspaces:

devpod context set-options default -o SSH_INJECT_GIT_CREDENTIALS=false

To see which identity the workspace has, and to check which credentials git can use there:

devpod ssh my-workspace --command 'git config user.name && git config user.email'
devpod ssh my-workspace --command 'git ls-remote origin HEAD'

Forwarding the ssh-agent can be turned off for all workspaces, or for one devpod ssh session:

devpod context set-options default -o SSH_AGENT_FORWARDING=false
devpod ssh my-workspace --agent-forwarding=false

Both only work while you are connected to the workspace, because the credentials stay on your computer. For workspaces that must keep working without you, such as ones running AI agents, see Run Workspaces Unattended.

Git identity​

DevPod gives the dev container your git user.name and user.email, unless the container user's ~/.gitconfig already has them (for example from the container's own start command). It uses the identity git uses in the repository the workspace comes from: the workspace's local folder or, for other sources, the directory you run devpod up from. That includes the repository's config and the include and includeIf directives that match it, so running devpod up from inside a work repository gives the workspace your work identity.

devpod up saves that identity with the workspace, and running it again, from anywhere, doesn't change it. If devpod up doesn't run in a repository (for example from the desktop app, for a git source), it saves nothing, and the container gets your global identity, following the global config's includes, when it connects.

Git ignores a repository it doesn't trust, for example one on a network share or owned by another user, and then DevPod can't use its identity. Add it to git's safe.directory to fix that.

To set the identity explicitly, pass it to devpod up. An empty value removes the saved one, so that DevPod looks it up again:

devpod up --git-user-email me+devpod@company.com --git-user-name "My Name" my-workspace

A dev container that already has an identity keeps it, and so do the dev containers of workspaces created before DevPod saved the identity. Use devpod up --recreate to give the container the new one.

git in the dev container also trusts the workspace folder when it isn't owned by the container user, as with Docker Desktop on macOS and Windows: DevPod adds it to safe.directory in the system git config, so git doesn't refuse it with "detected dubious ownership".

To sign commits with an ssh key, pass the key that git should use. DevPod forwards signing requests to your computer (also while connected only), unless GIT_SSH_SIGNATURE_FORWARDING is false:

devpod up my-workspace --git-ssh-signing-key ~/.ssh/id_ed25519.pub
devpod context set-options default -o GIT_SSH_SIGNATURE_FORWARDING=false

Docker credentials​

DevPod will make docker registry credentials available inside the dev container through a docker credentials helper. This allows you to pull and push images from and to private registries from within the dev container.

If you don't want DevPod to inject the credentials, you can disable that via the following command for all workspaces:

devpod context set-options default -o SSH_INJECT_DOCKER_CREDENTIALS=false

To check that the dev container can pull from a private registry:

devpod ssh my-workspace --command 'docker pull ghcr.io/my-org/private-image:latest'

GPG credentials​

DevPod will make gpg keys available inside the dev container through an ssh tunnel. This allows you to sign commits from inside the workspace.

If you want DevPod to inject the gpg keys, you must that via the following command for all workspaces:

devpod context set-options default -o GPG_AGENT_FORWARDING=true

Or when creating a workspace using:

devpod up --gpg-agent-forwarding my-workspace