Skip to content
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

docs: URL parameter for configuring remotes #2531

Merged
merged 9 commits into from
Jan 26, 2023
1 change: 1 addition & 0 deletions modules/end-user-guide/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*** xref:url-parameter-for-the-devfile-file-name.adoc[]
*** xref:url-parameter-for-the-devfile-file-path.adoc[]
*** xref:url-parameter-for-the-workspace-storage.adoc[]
*** xref:url-parameter-for-configuring-project-remotes.adoc[]
** xref:basic-actions-you-can-perform-on-a-workspace.adoc[]
** xref:authenticating-to-a-git-server-from-a-workspace.adoc[]
* xref:customizing-workspace-components.adoc[]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
:_content-type: CONCEPT
:description: URL parameter for configuring project remotes
:keywords: configuring-remotes, configuring-remotes-parameter, remotes-parameter, project-remotes-parameter
:navtitle: URL parameter for configuring project remotes
:page-aliases:

[id="url-parameter-for-configuring-project-remotes"]
= URL parameter for configuring project remotes

When you visit a URL for starting a new workspace, one Git remote will be configured by default. Git remotes can be configured manually in the command line after workspace startup, or manually by editing the workspace's {devworkspace} {orch-name} resource after workspace creation.
dkwon17 marked this conversation as resolved.
Show resolved Hide resolved

To have {prod-short} automatically configure Git remotes on workspace creation, the `remotes=<remotes>` URL parameter can be used.

The first remote specified in the `remotes` parameter will have it's default branch checked out on workspace startup.
dkwon17 marked this conversation as resolved.
Show resolved Hide resolved

The value of the `remotes` parameter can be provided in two formats: by providing both remote names and URLs, and by providing only URLs.
dkwon17 marked this conversation as resolved.
Show resolved Hide resolved

== Providing remote names and URLs

Remote names and URLs can be specified by providing a list of `{name,URL}` pairs in the following format:

[source,subs="+quotes,+attributes,+macros"]
----
{{origin,https://git-url/origin/project.git},{upstream,https://git-url/upstream/project.git}, ... } <1>
----

The following example configures two remotes on workspace creation, `origin` and `upstream`. The `origin` remote's default branch is checked out on workspace startup.
[source,subs="+quotes,+attributes,+macros"]
----
pass:c,a,q[{prod-url}]#__<git_repository_url>__?remotes={{origin,https://git-url/origin/project.git},{upstream,https://git-url/upstream/project.git}}
----

== Providing only URLs

Remote URLs can be specified by providing a list of URLs in the following format:

[source,subs="+quotes,+attributes,+macros"]
----
{https://git-url/origin/project.git,https://git-url/upstream/project.git, ... }
----

When remotes are configured in this format, the remote names are implicit.
The first remote is `origin`, the second remote is `upstream`, and subsequent remotes are `fork1`, `fork2`, ... , `fork(n-2)`.
max-cx marked this conversation as resolved.
Show resolved Hide resolved

The following example configures three remotes on workspace creation, `origin`, `upstream`, and `fork1`. The `origin` remote's default branch is checked out on workspace startup.
[source,subs="+quotes,+attributes,+macros"]
----
pass:c,a,q[{prod-url}]#__<git_repository_url>__?remotes={https://git-url/origin/project.git,https://git-url/upstream/project.git,https://git-url/user/project.git} <1>
----