Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf1feb40

Browse files
docs: clone git repositories (#14090)
1 parent48f29a1 commitf1feb40

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#Cloning Git Repositories
2+
3+
<divstyle="padding:0px;margin:0px;">
4+
<spanstyle="vertical-align:middle;">Author: </span>
5+
<ahref="https://github.com/BrunoQuaresma"style="text-decoration:none;color:inherit;margin-bottom:0px;">
6+
<span style="vertical-align:middle;">Bruno Quaresma</span>
7+
<img src="https://avatars.githubusercontent.com/u/3165839?v=4" width="24px" height="24px" style="vertical-align:middle; margin: 0px;"/>
8+
</a>
9+
</div>
10+
August 06, 2024
11+
12+
---
13+
14+
When starting to work on a project, engineers usually need to clone a Git
15+
repository. Even though this is often a quick step, it can be automated using
16+
the[Coder Registry](https://registry.coder.com/) to make a seamless Git-first
17+
workflow.
18+
19+
The first step to enable Coder to clone a repository is to provide
20+
authorization. This can be achieved by using the Git provider, such as GitHub,
21+
as an authentication method. If you don't know how to do that, we have written
22+
documentation to help you:
23+
24+
-[GitHub](https://coder.com/docs/admin/auth#github)
25+
-[GitLab self-managed](https://coder.com/docs/admin/external-auth#gitlab-self-managed)
26+
-[Self-managed git providers](https://coder.com/docs/admin/external-auth#self-managed-git-providers)
27+
28+
With the authentication in place, it is time to set up the template to use the
29+
[Git Clone module](https://registry.coder.com/modules/git-clone) from the
30+
[Coder Registry](https://registry.coder.com/) by adding it to our template's
31+
Terraform configuration.
32+
33+
```hcl
34+
module "git-clone" {
35+
source = "registry.coder.com/modules/git-clone/coder"
36+
version = "1.0.12"
37+
agent_id = coder_agent.example.id
38+
url = "https://github.com/coder/coder"
39+
}
40+
```
41+
42+
>You can edit the template using an IDE or terminal of your preference, or by
43+
>going into the
44+
>[template editor UI](https://coder.com/docs/templates/creating#editing-templates).
45+
46+
You can also use
47+
[template parameters](https://coder.com/docs/templates/parameters) to customize
48+
the Git URL and make it dynamic for use cases where a template supports multiple
49+
projects.
50+
51+
```hcl
52+
data "coder_parameter" "git_repo" {
53+
name = "git_repo"
54+
display_name = "Git repository"
55+
default = "https://github.com/coder/coder"
56+
}
57+
58+
module "git-clone" {
59+
source = "registry.coder.com/modules/git-clone/coder"
60+
version = "1.0.12"
61+
agent_id = coder_agent.example.id
62+
url = data.coder_parameter.git_repo.value
63+
}
64+
```
65+
66+
>If you need more customization, you can read the
67+
>[Git Clone module](https://registry.coder.com/modules/git-clone) documentation
68+
>to learn more about the module.
69+
70+
Don't forget to build and publish the template changes before creating a new
71+
workspace. You can check if the repository is cloned by accessing the workspace
72+
terminal and listing the directories.

‎docs/manifest.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,11 @@
11721172
"title":"Scanning Coder Workspaces with JFrog Xray",
11731173
"description":"Integrate Coder with JFrog Xray",
11741174
"path":"./guides/xray-integration.md"
1175+
},
1176+
{
1177+
"title":"Cloning Git Repositories",
1178+
"description":"Automatically clone Git repositories into your workspace",
1179+
"path":"./guides/cloning-git-repositories.md"
11751180
}
11761181
]
11771182
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp