Use this action to set up a Git global configuration for use in CloudBees workflows. This action authenticates the current user, by default scoped to repositories in the same organization as the workflow repository. After this step is run, all steps using the Git CLI in the same job authenticate with these credentials.
|
Tip
|
You can use this action to avoid failures due to lack of pre-authentication of private repositories. For example, if you are building a Go module that depends on other private modules, private repository authentication must be already in place for go mod download to run successfully.
|
|
Note
|
This action may set up authentication for different types of Git global configurations, including:
CloudBees recommends that if you are using a Git client other than the official Git CLI, make sure that your Git client supports the authentication configuration applied by this action. |
| Input name | Data type | Required? | Description |
|---|---|---|---|
|
String |
Yes |
Repository clone URL. https://github.com/user/repo
For listing multiple repositories, CloudBees recommends using a line break separator, although the |
|
String |
No |
SSH key used to fetch the repository.
The SSH key used for fetching a repository using it’s SSH clone URL (passed via the |
|
String |
No |
A list of known SSH hosts that should be added to the global host database. Use the utility The public keys for GitHub and Bitbucket are added by default. |
|
Boolean |
No |
Default is |
In your YAML file, add:
- name: Git global credentials
uses: cloudbees-io/configure-git-global-credentials@v2
with:
repositories: |
https://github.com/user1/repo
https://github.com/user2/rep1For configuring access for all repositories within a GitHub project/user namespace, you can specify the Project URL as an input: https://github.com/org/
- name: Git global credentials
uses: cloudbees-io/configure-git-global-credentials@v2
with:
repositories: https://github.com/org/You can also specify a host URL in the repositories input to grant access to all "accessible" repositories. This is dependent on the SCM Integration and credentials, permissions configured for those credentials which is setup on Unify for this component and it’s parent Organization(s).
- name: Git global credentials
uses: cloudbees-io/configure-git-global-credentials@v2
with:
repositories: https://github.beescloud.com/Using SSH, add the SSH key as a Secret property on Unify and use the SSH clone url in the repositories input.
|
Note
|
When defining the SSH key secret please ensure that there is a new line at the end of the secret. |
In your YAML file, add:
- name: Git global credentials
uses: cloudbees-io/configure-git-global-credentials@v2
with:
repositories: "ssh://github.com/user/repo"
ssh-key: ${{secrets.<ssh-secret-name-placeholder>}}This code is made available under the MIT license.
-
Learn more about using actions in CloudBees workflows.
-
Learn about the CloudBees platform.