Title: Shared workspaces: use the connecting user's Git identity and external auth credentials · Issue #31706 · coder/coder · GitHub
Open Graph Title: Shared workspaces: use the connecting user's Git identity and external auth credentials · Issue #31706 · coder/coder
X Title: Shared workspaces: use the connecting user's Git identity and external auth credentials · Issue #31706 · coder/coder
Description: Problem In a shared workspace, Git uses the workspace owner's identity and credentials for every user who connects, including users with only the use role. #31152 documents this behavior and the manual workarounds. Commit identity: templ...
Open Graph Description: Problem In a shared workspace, Git uses the workspace owner's identity and credentials for every user who connects, including users with only the use role. #31152 documents this behavior and the ma...
X Description: Problem In a shared workspace, Git uses the workspace owner's identity and credentials for every user who connects, including users with only the use role. #31152 documents this behavior and th...
Opengraph URL: https://github.com/coder/coder/issues/31706
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Shared workspaces: use the connecting user's Git identity and external auth credentials","articleBody":"## Problem\n\nIn a shared workspace, Git uses the workspace owner's identity and credentials for every user who connects, including users with only the `use` role.\n#31152 documents this behavior and the manual workarounds.\n\n- **Commit identity:** templates commonly set `GIT_AUTHOR_*` and `GIT_COMMITTER_*` from `data.coder_workspace_owner.me` at build time.\n- **Git over SSH:** `coder gitssh` fetches the owner's key (`GetGitSSHKey(ctx, workspace.OwnerID)` in `coderd/gitsshkey.go`).\n- **Git over HTTPS:** `workspaceAgentsExternalAuth` in `coderd/workspaceagents.go` looks up the external auth link by `workspace.OwnerID`.\n\nTo work as themselves, shared users must export `GIT_AUTHOR_*` in every shell, forward their SSH agent, or sign in to a tool such as the GitHub CLI.\nEvery one of these overrides is visible to the other users of the workspace.\n\n## Proposal\n\nSuggested by @matifali in https://github.com/coder/coder/pull/31152#discussion_r4451065288.\n\nCoder knows which user connects to a shared workspace, so it could set the commit identity for that user's session automatically.\nIt could also resolve external auth tokens for the connecting user instead of the owner.\n\n## Constraints to investigate\n\n1. **The agent doesn't know who is connected over SSH.**\n `ReportConnection` in `coderd/agentapi/connectionlog.go` leaves `UserID` unset with the comment \"It's not possible to tell which user connected.\"\n #27423 records the user in coderd when the tailnet tunnel opens, but it doesn't pass that identity to the agent or to the SSH session.\n2. **Template env vars override per-session env.**\n In `updateCommandEnv` in `agent/agent.go`, `coder_agent` env vars from the manifest override the session environment, so `coder ssh -e GIT_AUTHOR_NAME=...` has no effect when the template sets `GIT_AUTHOR_*`.\n A per-user identity must take precedence over template values, or templates must stop setting these variables.\n3. **External auth is requested with the shared agent token.**\n `coder gitaskpass` and `coder external-auth access-token` call the agent API with the workspace's agent token, so coderd can't tell which user is asking.\n4. **All users share one OS user and home directory.**\n A token injected into one user's session is readable by other users through the process environment, Git credential caches, or files in `$HOME`.\n Per-user external auth needs an isolation design, not only plumbing.\n5. **Some processes aren't tied to one connection.**\n Long-running processes, such as code-server started once for the workspace, have no single connecting user.\n\n---\n\n_Generated by Coder Agents on behalf of @nickvigilante._\n","author":{"url":"https://github.com/nickvigilante","@type":"Person","name":"nickvigilante"},"datePublished":"2026-11-03T18:25:20Z","url":"https://github.com/coder/coder/issues/31706"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:02cf7e75-a52e-9b82-319d-7911dca6fec5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8816:B1B84:1152313:15F2968:6B015430 |
| html-safe-nonce | 71ab15e1ea7e9d2764b6228f1fa4e0c02ebc792efe779aa37d2d6089548169be |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODE2OkIxQjg0OjExNTIzMTM6MTVGMjk2ODo2QjAxNTQzMCIsInZpc2l0b3JfaWQiOiIyOTk1MjM4NTMyNDk2MzE1NDQwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 06255c74471d7d9a16fc73fa0e4ae644c67c1dc06a1dc299e649cefbd4dd1782 |
| hovercard-subject-tag | issue:6188695159 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/coder/coder/31706/issue_layout |
| twitter:image | https://opengraph.githubassets.com/27d23de234a7e7cd3c281e6e7227b995e02d0fa9b5dc00deb01b986619570d75/coder/coder/issues/31706 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/27d23de234a7e7cd3c281e6e7227b995e02d0fa9b5dc00deb01b986619570d75/coder/coder/issues/31706 |
| og:image:alt | Problem In a shared workspace, Git uses the workspace owner's identity and credentials for every user who connects, including users with only the use role. #31152 documents this behavior and the ma... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nickvigilante |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/coder/coder git https://github.com/coder/coder.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 440752086 |
| octolytics-dimension-repository_nwo | coder/coder |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 440752086 |
| octolytics-dimension-repository_network_root_nwo | coder/coder |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width