Skip to content

Commit f270a44

Browse files
committed
docs/artifact: clarify git:: prefix usage for private repos
1 parent 7e44f2b commit f270a44

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

website/content/docs/job-specification/artifact.mdx

+8-2
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,22 @@ artifact {
117117
}
118118
```
119119

120-
To download from private repo, sshkey needs to be set. The key must be
120+
To download from a private repo, sshkey needs to be set. The key must be
121121
base64-encoded string. On Linux, you can run `base64 -w0 <file>` to encode the
122122
file. Or use [HCL2](https://www.nomadproject.io/docs/job-specification/hcl2)
123123
expressions to read and encode the key from a file on your machine:
124124

125125
```hcl
126126
artifact {
127-
source = "[email protected]:example/nomad-examples"
127+
# The git:: prefix forces go-getter's protocol detection to use the git ssh
128+
# protocol. It can also automatically detect the protocol from the domain of
129+
# some git hosting providers (such as GitHub) without the prefix.
130+
source = "git::[email protected]:example/nomad-examples"
128131
destination = "local/repo"
129132
options {
133+
# Make sure that the Nomad user's known hosts file is populated:
134+
# ssh-keyscan github.com | sudo tee -a /root/.ssh/known_hosts
135+
# https://github.com/hashicorp/go-getter/issues/55
130136
sshkey = "${base64encode(file(pathexpand("~/.ssh/id_rsa")))}"
131137
}
132138
}

0 commit comments

Comments
 (0)