-
Notifications
You must be signed in to change notification settings - Fork 890
docs: clone git repositories #14090
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
docs: clone git repositories #14090
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
docs: cloning git repositories
- Loading branch information
commit 7b6f49b10f43b9cda2646e3d2f040f8d6b02c2e1
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Cloning Git Repositories | ||
|
||
<div style="padding: 0px; margin: 0px;"> | ||
<span style="vertical-align:middle;">Author: </span> | ||
<a href="https://github.com/Emyrk" style="text-decoration: none; color: inherit; margin-bottom: 0px;"> | ||
<span style="vertical-align:middle;">Bruno Quaresma</span> | ||
<img src="https://avatars.githubusercontent.com/u/3165839?v=4" width="24px" height="24px" style="vertical-align:middle; margin: 0px;"/> | ||
</a> | ||
</div> | ||
August 01, 2024 | ||
|
||
--- | ||
|
||
When starting to work on a project, engineers usually need to clone a Git | ||
repository. Even though this is often a quick step, Coder can automate it to | ||
make the flow more seamless, creating workspaces ready for development and | ||
BrunoQuaresma marked this conversation as resolved.
Show resolved
Hide resolved
|
||
reducing onboarding time. | ||
|
||
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: [Authentication with GitHub](/admin/auth#github). | ||
|
||
BrunoQuaresma marked this conversation as resolved.
Show resolved
Hide resolved
|
||
With the authentication in place, it is time to set up the template to use the | ||
[Git Clone module](https://registry.coder.com/modules/git-clone) from the | ||
[Coder Registry](https://registry.coder.com/) by adding it to our template's | ||
Terraform configuration. | ||
|
||
```hcl | ||
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](/templates/creating#editing-templates). | ||
|
||
You can also use [template parameters](/templates/parameters) to customize the | ||
BrunoQuaresma marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Git URL and make it dynamic for use cases where a template supports multiple | ||
projects. | ||
|
||
```hcl | ||
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](https://registry.coder.com/modules/git-clone) 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. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.