Files
coder/docs/tutorials/cloning-git-repositories.md
Edward Angert 5c16079aff docs: add more specific steps and information about oidc refresh tokens (#18336)
closes https://github.com/coder/coder/issues/18307

relates to https://github.com/coder/coder/pull/18318

preview:
-
[refresh-tokens](https://coder.com/docs/@18307-refresh-tokens/admin/users/oidc-auth/refresh-tokens)
-
[configuring-okta](https://coder.com/docs/@18307-refresh-tokens/tutorials/configuring-okta)
~(not sure why @Emyrk 's photo is so huge there though)~ ✔️
- [x] removed from
[idp-sync](https://coder.com/docs/@18307-refresh-tokens/admin/users/idp-sync)

to do:
- move keycloak
- add ping federate and azure
- edit text (possibly placeholders for now - I want to see how it all
relates and edit it again. right now, there's a note about the same
thing in every section in way that's not super helpful/necessary)
- ~convert some paragraphs to OL~ calling this out of scope for now

---------

Co-authored-by: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com>
2025-06-16 13:18:55 -04:00

2.5 KiB

Cloning Git Repositories

August 06, 2024

When starting to work on a project, engineers usually need to clone a Git repository. Even though this is often a quick step, it can be automated using the Coder Registry to make a seamless Git-first workflow.

The first step to enable Coder to clone a repository is to provide authorization. This can be achieved by using the Git provider, such as GitHub, as an authentication method. If you don't know how to do that, we have written documentation to help you:

With the authentication in place, it is time to set up the template to use the Git Clone module from the Coder Registry by adding it to our template's Terraform configuration.

module "git-clone" {
  source   = "registry.coder.com/modules/git-clone/coder"
  version  = "1.0.12"
  agent_id = coder_agent.example.id
  url      = "https://github.com/coder/coder"
}

You can edit the template using an IDE or terminal of your preference, or by going into the template editor UI.

You can also use template parameters to customize the Git URL and make it dynamic for use cases where a template supports multiple projects.

data "coder_parameter" "git_repo" {
  name         = "git_repo"
  display_name = "Git repository"
  default      = "https://github.com/coder/coder"
}

module "git-clone" {
  source   = "registry.coder.com/modules/git-clone/coder"
  version  = "1.0.12"
  agent_id = coder_agent.example.id
  url      = data.coder_parameter.git_repo.value
}

If you need more customization, you can read the Git Clone module documentation to learn more about the module.

Don't forget to build and publish the template changes before creating a new workspace. You can check if the repository is cloned by accessing the workspace terminal and listing the directories.