- Notifications
You must be signed in to change notification settings - Fork1k
docs: add details on external authentication priority#17164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
911c820
5166509
58bbd31
368b131
aaec21d
64dacc7
da3c83c
6ba6b94
d684ca2
8d481de
fffa8c0
435c6a1
83e4bc9
1c3e054
41f6009
35cfc21
de29681
b8a8cd8
68c21bd
c19be18
556d972
8bcda22
0bfaae8
5508c56
4788ff0
bfc852e
c58f378
5f1d359
f86b434
5b39e95
a039753
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -71,6 +71,55 @@ Use [`external-auth`](../reference/cli/external-auth.md) in the Coder CLI to acc | ||
coder external-auth access-token <USER_DEFINED_ID> | ||
``` | ||
## Git Authentication in Workspaces | ||
Coder provides automatic Git authentication for workspaces through SSH authentication and Git-provider specific env variables. | ||
When performing Git operations, Coder first attempts to use external auth provider tokens if available. | ||
If no tokens are available, it defaults to SSH authentication. | ||
### OAuth (external auth) | ||
For Git providers configured with [external authentication](#configuration), Coder can use OAuth tokens for Git operations. | ||
When Git operations require authentication, and no SSH key is configured, Coder will automatically use the appropriate external auth provider based on the repository URL. | ||
For example, if you've configured a GitHub external auth provider and attempt to clone a GitHub repository, Coder will use the OAuth token from that provider for authentication. | ||
To manually access these tokens within a workspace: | ||
```shell | ||
coder external-auth access-token <USER_DEFINED_ID> | ||
``` | ||
### SSH Authentication | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I feel like that this whole SSH authentication section should not be here. I don't have a strong opinion so will leave this to you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. you might be right. I found anSSH Keys section in secrets.md that starts to explain this, but it doesn't quite fit there either I think this fits better as a user guide. I'll leave the section here for now as it is something that an admin can help their user with, and we should aim to include this in future user-facing docs | ||
Coder automatically generates an SSH key pair for each user that can be used for Git operations. | ||
When you use SSH URLs for Git repositories, for example, `git@github.com:organization/repo.git`, Coder checks for and uses an existing SSH key. | ||
If one is not available, it uses the Coder-generated one. | ||
The `coder gitssh` command wraps the standard `ssh` command and injects the SSH key during Git operations. | ||
This works automatically when you: | ||
1. Clone a repository using SSH URLs | ||
1. Pull/push changes to remote repositories | ||
1. Use any Git command that requires SSH authentication | ||
You must add the SSH key to your Git provider. | ||
#### Add your Coder SSH key to your Git provider | ||
1. View your Coder Git SSH key: | ||
```shell | ||
coder publickey | ||
``` | ||
1. Add the key to your Git provider accounts: | ||
- [GitHub](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account#adding-a-new-ssh-key-to-your-account) | ||
- [GitLab](https://docs.gitlab.com/user/ssh/#add-an-ssh-key-to-your-gitlab-account) | ||
## Git-provider specific env variables | ||
### Azure DevOps | ||